Solved

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

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

734 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