[logback-user] TimeBasedRollingPolicy

Ceki Gulcu listid at qos.ch
Wed Oct 1 11:34:48 CEST 2008


Hello Johannes,

The partial configuration file looks good, so does the status messages from 
Joran. Are you logging in a continuous loop? Roll over occurs only when there 
are incoming logging events. (Elapsing of time is not sufficient.)

Lang, Johannes wrote:
> Hello,
> 
> i'm trying to get a RollingFileAppender with a TimeBasedRollingPolicy
> working, but i don't succeed.
> Here's my Appender-Configuration (which i copied from the
> logback-manual; only changed the layout):
> 
>   <appender name="FILE"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>     <File>logFile.log</File>
>     <rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>  
> <FileNamePattern>logFile.%d{yyyy-MM-dd_HH-mm}.log</FileNamePattern>
>     </rollingPolicy>
> 
>     <layout class="ch.qos.logback.classic.PatternLayout">
>       <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
> %msg%n</Pattern>
>     </layout>
>   </appender> 
> 
> And this is some of the debug-output from the Joran-Configurator:
> 
> 	09:06:48,703 |-INFO in
> ch.qos.logback.core.joran.action.AppenderAction - Naming appender as
> [FILE]
> 	09:06:48,734 |-INFO in
> ch.qos.logback.core.joran.action.NestedComponentIA - Pushing component
> [rollingPolicy] on top of the object stack.
> 	09:06:48,734 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy
> - Adding parent to RollingPolicy: FILE
> 	09:06:48,734 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy
> - No compression will be used
> 	09:06:48,734 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy
> - Will use the pattern logFile.%d{yyyy-MM-dd_HH-mm}.log for the active
> file
> 	09:06:48,750 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy
> - The date pattern is 'yyyy-MM-dd_HH-mm' from file name pattern
> 'logFile.%d{yyyy-MM-dd_HH-mm}.log'.
> 	09:06:48,750 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy
> - Roll-over every minute.
> 	09:06:48,750 |-INFO in
> ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file
> name: logFile.log
> 	09:06:48,750 |-INFO in
> ch.qos.logback.core.joran.action.AppenderAction - Popping appender named
> [FILE] from the object stack
> 	09:06:48,750 |-INFO in
> ch.qos.logback.classic.joran.action.LevelAction - root level set to
> TRACE
> 	09:06:48,750 |-INFO in
> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender
> named [stout] to Logger[root]
> 	09:06:48,750 |-INFO in
> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender
> named [FILE] to Logger[root]
> 	09:06:48,750 |-INFO in
> ch.qos.logback.classic.joran.action.ConfigurationAction - End of
> configuration.
> 
> Everything seems correct. "Roll-over every minute" is just what i want
> to do. But what really happens is, that all logging is written to the
> file "logFile.log". There is no rollover. Any suggestions what's wrong
> with my appender-config?
> 
> Cheers
> Johannes

-- 
Ceki Gülcü


More information about the Logback-user mailing list