Solved

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

Posted on 2013-11-14
5
2,808 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 36

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 36

Expert Comment

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

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

696 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