• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3414
  • Last Modified:

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

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
pvinodp
Asked:
pvinodp
  • 2
  • 2
1 Solution
 
ManishLeadCommented:
I think you are getting space in date.
Check here sample for data pattern.
http://logback.qos.ch/manual/appenders.html
0
 
ManishLeadCommented:
Check for <timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/>
0
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
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
 
pvinodpAuthor Commented:
thanks
0
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
You're welcome!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now