Solved

Why am i getting the error "does not contain a valid IntegerToken" when using lobback.xml

Posted on 2013-11-14
5
2,265 Views
Last Modified: 2013-12-17
I changed the following line in logback.xml :

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
     <fileNamePattern>${LOCATION}${BASE_NAME}_%d.log</fileNamePattern>
</rollingPolicy>

to

<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <fileNamePattern>${LOCATION}${BASE_NAME}_%d.log</fileNamePattern>
    <minIndex>1</minIndex>
    <maxIndex>10</maxIndex>
</rollingPolicy>

<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <maxFileSize>200MB</maxFileSize>
</triggeringPolicy>

Now I am getting this error whenever my application tries to log :

  at java.lang.IllegalStateException: FileNamePattern [/var/log/iess/abc/abc__%d.log] does not contain a valid IntegerToken
        at      at ch.qos.logback.core.rolling.FixedWindowRollingPolicy.start(FixedWindowRollingPolicy.java:92)
        at      at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
        at      at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:315)
        at      at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:194)
        at      at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:180)
        at      at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:52)
        at      at ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:332)
        at      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:132)
        at      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:93)
0
Comment
Question by:pvinodp
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Manish
ID: 39650535
I think you are getting space in date.
Check here sample for data pattern.
http://logback.qos.ch/manual/appenders.html
0
 
LVL 11

Expert Comment

by:Manish
ID: 39650537
Check for <timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/>
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39655104
Have you checked out the documentation for that Policy...

http://logback.qos.ch/manual/appenders.html#FixedWindowRollingPolicy

The second paragraph of that section gives you your answer (emphasis added by me)...
The fileNamePattern option represents the file name pattern for the archived (rolled over) log files. This option is required and must include an integer token %i somewhere within the pattern.
Therefore, you need to change the %d in your current fileNamePattern to be %i.
0
 

Author Closing Comment

by:pvinodp
ID: 39723192
thanks
0
 
LVL 35

Expert Comment

by:mccarl
ID: 39723416
You're welcome!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now