
[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Eric Roberts commented on LBCORE-147: ------------------------------------- Referencing the configuration in Dieter Mueller's comment: <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- rollover daily --> <fileNamePattern>foo-%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> <maxHistory>4</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>20MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> I would expect this to only keep the last 4 days of log files. So if I had the following log files generated (assuming maxHistory=4 ): foo-2011-03-21.0.log.zip foo-2011-03-21.1.log.zip foo-2011-03-21.2.log.zip foo-2011-03-22.0.log.zip foo-2011-03-23.0.log.zip foo-2011-03-24.0.log.zip foo.log on 2011-03-26 I would expect that the logs from 2011-03-21 would be deleted and the listing would then be: foo-2011-03-22.0.log.zip foo-2011-03-23.0.log.zip foo-2011-03-24.0.log.zip foo-2011-03-25.0.log.zip foo.log However, this doesn't happen and I was unable to find any combination of rolling/triggering policies that would do this. It would seem that timeBasedFileNamingAndTriggeringPolicy ignores maxHistory.
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