Solved

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

Posted on 2013-11-14
5
2,447 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

776 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