[logback-dev] [JIRA] Commented: (LBCORE-147) RollingPolicy MaxHistory not deleting old files

Alexander Lauper (JIRA) noreply-jira at qos.ch
Fri Sep 2 14:05:16 CEST 2011

    [ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12112#action_12112 ] 

Alexander Lauper commented on LBCORE-147:


Relying on the application is only required when following my suggestion #2.
As I always use daily rollover and I will add a "system status"-log entry (free memory and disk space) anyway I wouldn't have to parse logback configuration in my case. But you are right, we should find a solution which fits the majority of use cases. I didn't think of the problems you mentioned ...

However, as I heard, Ceki would rather follow the maxQ solution. So don't worry :-) . The maxQ solution copes easily with quiescent periods (as long as the quiescent period is shorter than maxQ) without having to rely on the application.

I am not sure whether we should separate the problems:
Assumed that logback would never create "gaps" in log history no matter how long a quiescent period is (e.g. by creating empty log files when no logging event occured during the rollover period before) the existing mechanism would almost work. Only an additional check on application startup would be required to cope with powerfail-, machine-out-of-service-, application-not-running-periods longer than a rollover period.

Kind regards,

> RollingPolicy MaxHistory not deleting old files
> -----------------------------------------------
>                 Key: LBCORE-147
>                 URL: http://jira.qos.ch/browse/LBCORE-147
>             Project: logback-core
>          Issue Type: Bug
>          Components: Rolling
>    Affects Versions: 0.9.18
>         Environment: linux 2.6.18 64bits apache-tomcat-6.0.20 java/jre1.6.0_18
>            Reporter: Rafael Diaz Maurin
>            Assignee: Ceki Gulcu
>         Attachments: TimeBasedRollingWithArchiveRemovalTest.java
> The MaxHistory does not do the trick : the old files are not deleted at all :
> cat logging.xml
>  <appender name="IDP_ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
>         <File>/shibboleth-idp/logs/idp-access.log</File>
>             <Append>false</Append>
> 	<ImmediateFlush>true</ImmediateFlush>
>        <RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>             <FileNamePattern>/shibboleth-idp/logs/old/idp-access-%d{yyyy-MM-dd_HH-mm}.log.gz</FileNamePattern>
> 	    <MaxHistory>3</MaxHistory>
>         </RollingPolicy>
>         <layout class="ch.qos.logback.classic.PatternLayout">
>             <Pattern>%msg%n</Pattern>
>         </layout>
>     </appender>

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the logback-dev mailing list