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

Dieter Mueller (JIRA) noreply-jira at qos.ch
Thu Dec 9 11:24:51 CET 2010


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

Dieter Mueller commented on LBCORE-147:
---------------------------------------

I wrote:
>It seems, that logback calculates the ONE day to be deleted. It does not look back into the past, which is reasonable to me,
>because how far it should look back?

Perhaps a simple but unorthodox way would be, if there is a list (e.g. property-file) of created log files is maintained and
persisted by logback. On every rollover the list is loaded and checked for old, deleteable files.
I assume, the list would not be that big, so that there should be no big performance impact.

One additional sugar piece would be, that if the filename patten (e.g. directory structure) is changed between a run of
the application, logback will still be able, to delete an old logfile, which does not follow the new (changed) file name pattern.

On the other hand, concurent access to this file via threads or several VMs will have to be synchronized?

Dieter Mueller


> 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
>
> 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