
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

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ü

Hi Ceki, thanx for your response. my test-application ran under a minute. and now it's clear to me that every time i restart the application the logging-configuration starts from scratch. therefore i never had a rollover. I introduced a sleep to make my app run longer than a minute; and it works. thanks for your help. cheers Johannes -----Ursprüngliche Nachricht----- Von: logback-user-bounces@qos.ch [mailto:logback-user-bounces@qos.ch] Im Auftrag von Ceki Gulcu Gesendet: Mittwoch, 1. Oktober 2008 11:35 An: logback users list Betreff: Re: [logback-user] TimeBasedRollingPolicy 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ü _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Sorry for disturbing again but was my question too stupid to answer to or is the answer too difficult? -- View this message in context: http://www.nabble.com/TimeBasedRollingPolicy-tp19756004p22584536.html Sent from the Logback User mailing list archive at Nabble.com.
participants (3)
-
Ceki Gulcu
-
Lang, Johannes
-
paha