[logback-user] FileNamePattern [] does not contain a valid DateToken

David Roussel nabble at diroussel.xsmail.com
Wed Jan 12 17:06:29 CET 2011


Try putting a valid date token in your file name pattern!

I would guess that the TimeBasedRollingPolicy you are using needs to know
how to put the date in the file name.

David


Jonas Pacheco-2 wrote:
> 
> I'm having a 'FileNamePattern [] does not contain a valid DateToken'
> exception on run time. This happens only on Windows 7 x64 running on a
> JVM x86 or x64.
> 
> My configuration file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration>
> 	<appender name="APP"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>     	<File>${APP_HOME}\logs\app\app.log</File>    		
> 		<rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>       		<FileNamePattern>${APP_HOME}\logs\app\app.%d.gz</FileNamePattern>
>       		<MaxHistory>30</MaxHistory>
>     	</rollingPolicy>			
>     	<layout class="ch.qos.logback.classic.PatternLayout">
>       		<Pattern>%-5level %date{dd/MM/yy HH:mm:ss}  [%thread]
> %logger{20} - %X{state} - %X{identity}%n%msg%n%n</Pattern>
>     	</layout>
>   	</appender>
>   	<logger name="net.app"
>   				additivity="false"
>   				level="debug">
>     	<appender-ref ref="APP"/>
>   	</logger>
> 	<root level="info">
> 		<appender-ref ref="APP"/>
> 	</root>
> </configuration>
> 
> Stdout information:
> 
> 09:54:48,807 |-INFO in ch.qos.logback.core.joran.action.AppenderAction
> - About to instantiate appender of type
> [ch.qos.logback.core.rolling.RollingFileAppender]
> 09:54:48,807 |-INFO in ch.qos.logback.core.joran.action.AppenderAction
> - Naming appender as [APP]
> 09:54:48,901 |-INFO in
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing
> component [rollingPolicy] on top of the object stack.
> 09:54:48,901 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy -
> Adding parent to RollingPolicy: APP
> 09:54:48,948 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy -
> Will use gz compression
> 09:54:48,948 |-ERROR in
> ch.qos.logback.core.joran.spi.Interpreter at 11:22 - RuntimeException in
> Action for tag [rollingPolicy] java.lang.IllegalStateException:
> FileNamePattern [C:\Program Files (x86)\app\logs\app\app.%d.gz] does
> not contain a valid DateToken
>         at java.lang.IllegalStateException: FileNamePattern
> [C:\Program Files (x86)\app\logs\app\app.%d.gz] does not contain a
> valid DateToken
>         at      at
> ch.qos.logback.core.rolling.TimeBasedRollingPolicy.start(TimeBasedRollingPolicy.java:87)
>         at      at
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:159)
>         at      at
> ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:307)
>         at      at
> ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:187)
>         at      at
> ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:174)
>         at      at
> ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:48)
>         at      at
> ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:324)
>         at      at
> ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:109)
>         at      at
> ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:76)
>         at      at
> ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:40)
>         at      at
> ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:47)
>         at      at
> ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:108)
>         at      at
> org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
>         at      at
> org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:56)
>         at      at
> org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
>         at      at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
>         at      at
> org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
>         at      at
> org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
>         at      at
> org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
>         at      at
> org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
>         at      at
> br.com.ibnetwork.xingu.container.impl.ContainerSupport.<init>(ContainerSupport.java:23)
>         at      at
> br.com.ibnetwork.xingu.container.impl.Pulga.<init>(Pulga.java:39)
>         at      at
> br.com.ibnetwork.xingu.container.ContainerUtils.createContainer(ContainerUtils.java:70)
>         at      at
> br.com.ibnetwork.xingu.container.ContainerUtils.getContainer(ContainerUtils.java:62)
>         at      at app.daemon.DaemonRunner.configure(DaemonRunner.java:42)
>         at      at app.daemon.DaemonRunner.main(DaemonRunner.java:61)
>         at      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>         at      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
>         at      at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at      at java.lang.reflect.Method.invoke(Unknown Source)
>         at      at app.Launcher.launch(Launcher.java:42)
>         at      at app.Launcher.main(Launcher.java:26)
> 09:54:48,948 |-ERROR in
> ch.qos.logback.core.joran.spi.Interpreter at 13:59 - no applicable action
> for [layout], current pattern is[[configuration][appender][layout]]
> 09:54:48,948 |-ERROR in
> ch.qos.logback.core.joran.spi.Interpreter at 14:18 - no applicable action
> for [Pattern], current pattern is
> [[configuration][appender][layout][Pattern]]
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 
> 

-- 
View this message in context: http://old.nabble.com/FileNamePattern----does-not-contain-a-valid-DateToken-tp30653053p30654331.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list