[JIRA] Created: (LBCORE-147) RollingPolicy MaxHistory not deleting old files

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: Logback dev list 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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Dieter Mueller commented on LBCORE-147: --------------------------------------- Same as for uncompressed old files. Files older than maxHistory are not deleted. Thanx in advance, 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: Logback dev list
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu reassigned LBCORE-147: --------------------------------- Assignee: Ceki Gulcu (was: Logback dev list)
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- I am pretty confident that history clean up works rather well. Have you tried using more recent version of logback?
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Dieter Mueller commented on LBCORE-147: --------------------------------------- I just tested it with current version 0.9.26 and verified the bug. config: <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> But the main key is, that the application did not run for some days: e.g. Today (09.12.) I had logfiles from 1.12, 2.12., 3.12, 4.12. 5.12., 6.12. When I started the app, then the logfile from 4.12. (older than 4 days) was deleted, but the older ones (1.12. 2.12., 3.12) were not deleted. 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? regards, 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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] 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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Greg Thomas commented on LBCORE-147: ------------------------------------ I'm seeing the same problem; can I suggest an alternative, simpler, solution instead of having a persistent list of log files. Currently, if maxHistory=5 and the system is quiescent over the weekend so no logs are produced then ... 2011-02-17: Log file created (Thursday), log file for 2011-02-12 deleted if exists. 2011-02-18: Log file created (Friday), log file for 2011-02-13 deleted if exists. (2011-02-19: Saturday - No activity) (2011-02-20: Sunday - No activity) 2011-02-21: Log file created (Monday), log file for 2011-02-16 deleted if exists. This leaves the files for the 2011-02-14 and 2011-02-15 lying around. I'd suggest that a new optional setting is added, "maxHistoryGap" that indicates how far back the old old log files should be deleted (default value=0). If set to 2 (to cope with weekends). This would result in ... 2011-02-17: Log file created (Thursday), log files for 2011-02-12, 2011-02-11, 2011-02-10 deleted if exists. 2011-02-18: Log file created (Friday), log files for 2011-02-13, 2011-02-12, 2011-02-11 deleted if exists. (2011-02-19: Saturday - No activity) (2011-02-20: Sunday - No activity) 2011-02-21: Log file created (Monday), log files for 2011-02-16, 2011-02-15, 2011-02-14 deleted if exists. I may be able to submit a patch to this effect, if the solution is acceptable.
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

[ 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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] HC updated LBCORE-147: ---------------------- Attachment: TimeBasedRollingWithArchiveRemovalTest.java Hello, I can see the same issue on our production machines. We use logback and logs are not deleted using ch.qos.logback.core.rolling.TimeBasedRollingPolicy with ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP triggering policy. It seems issue can be replicated by slightly modifying one of the existing tests from logback's test suite: TimeBasedRollingWithArchiveRemovalTest.java. Please see the test named dailyChronologSizeBasedRolloverWhenLogFilenameDoesNotContainDirectory() in the attached file. It seems that if the log filename does not contain directory information no files are deleted. At a quick glance, the faulty code would be in {{SizeAndTimeBasedArchiveRemover.clean()}} {code} ... File parentDir = archive0.getParentFile(); File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex); {code} {{File parentDir = archive0.getParentFile();}} will always return null and hence FileFilterUtil.filesInFolderMatchingStemRegex() will return immediately when a null parameter is sent. Best Regards, Horace
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] HC edited comment on LBCORE-147 at 7/1/11 4:35 PM: --------------------------------------------------- Hello, I can see the same issue on our production machines. We use logback and logs are not deleted using ch.qos.logback.core.rolling.TimeBasedRollingPolicy with ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP triggering policy. It seems issue can be replicated by slightly modifying one of the existing tests from logback's test suite: TimeBasedRollingWithArchiveRemovalTest.java. Please see the test named dailyChronologSizeBasedRolloverWhenLogFilenameDoesNotContainDirectory() in the attached file. It seems that if the log filename does not contain directory information no files are deleted. At a quick glance, the faulty code would be in SizeAndTimeBasedArchiveRemover.clean() 1. File parentDir = archive0.getParentFile(); 2. File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex); The first line returns null for the specified case and hence FileFilterUtil.filesInFolderMatchingStemRegex() will return immediately when a null parameter is sent. Best Regards, Horace was (Author: hc): Hello, I can see the same issue on our production machines. We use logback and logs are not deleted using ch.qos.logback.core.rolling.TimeBasedRollingPolicy with ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP triggering policy. It seems issue can be replicated by slightly modifying one of the existing tests from logback's test suite: TimeBasedRollingWithArchiveRemovalTest.java. Please see the test named dailyChronologSizeBasedRolloverWhenLogFilenameDoesNotContainDirectory() in the attached file. It seems that if the log filename does not contain directory information no files are deleted. At a quick glance, the faulty code would be in {{SizeAndTimeBasedArchiveRemover.clean()}} {code} ... File parentDir = archive0.getParentFile(); File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex); {code} {{File parentDir = archive0.getParentFile();}} will always return null and hence FileFilterUtil.filesInFolderMatchingStemRegex() will return immediately when a null parameter is sent. Best Regards, Horace
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] HC updated LBCORE-147: ---------------------- Attachment: (was: TimeBasedRollingWithArchiveRemovalTest.java)
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] HC updated LBCORE-147: ---------------------- Attachment: TimeBasedRollingWithArchiveRemovalTest.java
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] HC edited comment on LBCORE-147 at 7/4/11 5:28 PM: --------------------------------------------------- Hello, I can see the same issue on our production machines. We use logback and logs are not deleted using ch.qos.logback.core.rolling.TimeBasedRollingPolicy with ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP triggering policy. A subset of the original problem is the case when the log filename does not contain directory information. This particular issue can be replicated by slightly modifying one of the existing tests from logback's test suite: TimeBasedRollingWithArchiveRemovalTest.java. Please see the test named dailyChronologSizeBasedRolloverWhenLogFilenameDoesNotContainDirectory() in the attached file. Best Regards, Horace was (Author: hc): Hello, I can see the same issue on our production machines. We use logback and logs are not deleted using ch.qos.logback.core.rolling.TimeBasedRollingPolicy with ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP triggering policy. It seems issue can be replicated by slightly modifying one of the existing tests from logback's test suite: TimeBasedRollingWithArchiveRemovalTest.java. Please see the test named dailyChronologSizeBasedRolloverWhenLogFilenameDoesNotContainDirectory() in the attached file. It seems that if the log filename does not contain directory information no files are deleted. At a quick glance, the faulty code would be in SizeAndTimeBasedArchiveRemover.clean() 1. File parentDir = archive0.getParentFile(); 2. File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex); The first line returns null for the specified case and hence FileFilterUtil.filesInFolderMatchingStemRegex() will return immediately when a null parameter is sent. Best Regards, Horace
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Anton Kudinov commented on LBCORE-147: -------------------------------------- Have same issue on my production machines. In another production Iuse log4j with org.apache.log4j.appender.TimeAndSizeRollingAppender - it work very good
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Alexander Lauper commented on LBCORE-147: ----------------------------------------- Hello Same situation here (logback 0.9.26, linux 2.6.26) using TimeBasedRollingPolicy. maxHistory is set to 30 (days) but I got 33 log files (would have expected 31). It's possible that the machine wasn't running for 2 days. As I am using this on a embedded device which might be out of service for 0 to infinite days the solution suggested by Greg Thomas would not work well for me. The documentation says: "The maxHistory property controls the maximum number of archive files to keep, deleting older files. For example, if you specify monthly rollover, and set maxHistory to 6, then 6 months worth of archives files will be kept with files older than 6 months deleted." I am very sorry, but this is not implemented that way. The current implementation deletes the one and only file based on the current date. According to the doc I guess most people (including me) would expect that there will never be more files than maxHistory + 1 regardless of any gaps the machine/application wasn't running. I strongly assume this would be the generally desired behaviour. An extreme example would be setting maxHistory to 1 and let the machine/application run every other day only. In this case I guess (didn't test it) the amount of files would grow indefinitely. On an unattended embedded device this might lead to a catastrophic situation (disk/flash space running out). What's the status on this issue? It was opened over a year ago ... Apart from that I love logback. Keep up the good work! Kind regards, Alex
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Greg Thomas commented on LBCORE-147: ------------------------------------ You're right, in that I know think that implementing the "maxHistoryGap" solution I referred to earlier is the right solution. Instead, I think that when a new log file is created, rather than just delete the "oldest+1" file, it's necessary to do a full directory scan, and delete all those that are too old - that copes for longer quiet periods. Of course, it's complicated because your not just dealing with files called, e.g. "2011-02-12.log", but they could be called "2011/02/12/data.log" - i.e. it's necessary to do a recursive directory scan. Ceki; if you think that solution is acceptable, let me know and I'll see if I can work on a fix for it. PS. For those looking the other (working) appender mentioned in this ticket, org.apache.log4j.appender.TimeAndSizeRollingAppender is, despite the name, not part of the Apache project - you can find more details on this at http://www.simonsite.org.uk/ - from a quick glance, it too appears to "scavenge" older files on a configurable interval. I don't think that's necessary in this case; older files only need to be scavenged when a new one is created.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Alexander Lauper commented on LBCORE-147: ----------------------------------------- Fully agree with you. I'm aware that this isn't an easy feature to implement. It would be less fast too (don't know whether this matters or not). In case you want to keep full backwards compatibility I wouldn't mind having to enable the "new" behaviour. A thought I came across: Instead of parsing the file paths/names maybe the file creation date could be used ...
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Greg Thomas commented on LBCORE-147: ------------------------------------ I don't believe speed would be an issue; you could spawn off a scavenging thread at the time you create a new log file; however it would use more resources, which could be an issue on embedded systems. Though that can be minimised by putting files in a single directory.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- I've spent some time tinkering with various approaches to solve this problem. Launching a scavenging thread sounds like overkill. The problem stems from the application being quiescent/inactive. If Q is the number of periods where the application was inactive, H is the value of maxHistory and C the current period, then it is sufficient to delete files in interval ranging from (C - H) to (C - (Q+H)) to address the issue at hand, i.e. this bug report. Moreover, it is sufficient to perform deletion of files in the said range only once, when the application starts. Of course, the problem with this approach is that while the values of H and C are known by logback, the value of Q is not. If there exists a value maxQ such that Q is always smaller than maxQ, we can check and delete all files in the range (C - H) to (C - (maxQ+H)) at application start up. If maxQ is 60 days, then for daily rollover maxQ corresponds to 60 periods and for monthly rollovers to 2 periods. For hourly rollover, it corresponds to 1440 (=60*24) periods, rather a large number. As long as the deletion method is somewhat optimized, the approach just described should work reasonably well even in the case of hourly rollover.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Greg Thomas commented on LBCORE-147: ------------------------------------ Some comments; 1. "it is sufficient to perform deletion of files in the said range only once, when the application starts" - what happens if the application is running but idle? Is there a thread that runs at midnight to rollover an empty file? (That's not what I'm seeing in logback 0.9.20, but I recognise I'm a bit behind on my versioning). Or does rollover only happen when a logging action occurs. If the latter, then you'll need to delete the files on application start *and* when a log file rolls over. However, in the latter case logback can know the value of Q, optimising things somewhat. 2. Perhaps make maxQ dependent on the rollover period, on the assumption that the more regularly you are rolling the more frequent you expect the logs to appear. e.g. something like If rolling monthly, maxQ = 1 year/12 files If rolling daily, maxQ = 60 days/60 files If rolling hourly, maxQ = 7 days/168 files 3. A variant on that - why not just make maxQ 60 rollovers. So ... If rolling monthly, maxQ = 60 months/5 years If rolling daily, maxQ = 60 days If rolling hourly, maxQ = 60 hours/2.5 days 4. Or make maxQ configurable - as I suggested on 21 Feb ("maxHistoryGap" is, I think the same as maxQ). 5. Although you suggest that a separate thread is overkill, checking/deleting multiple files *will* be slower than just deleting the one as currently occurs. I still think that doing it in a separate thread created at application start and each log file rollover would be better - to enable control to be returned to the application ASAP.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- 1) Rollover is triggered by the first LoggingEvent occurring subsequent to the begging of a new rollover period. Logback assumes that at least one LoggingEvent is generated per rollover period as the case where no LoggingEvent occurs in a period is highly unlikely (for any period duration over an hour). 2) I had a similar thought. However, the value of Q is independent of the length of the rollover period, is it not? 4) I'd like to avoid exposing a new parameter to the user unless there is a good need for it. 5) Creating a thread may be actually slower than deleting 20 local files. Files over the network is a different matter.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Greg Thomas commented on LBCORE-147: ------------------------------------ 1. "Logback assumes that at least one LoggingEvent is generated per rollover period" That assumption does not hold for my application; it's a web application that is running 24/7. The web server may get restarted at very infrequent intervals (perhaps a few times a year, after much form filling), but the application is typically not used at the weekend - so for two days a week the application is running but there is no logging activity. I can't believe that's an especially unusual scenario. For example, an application running 24/7 may be highly used during the working day, necessitating a hourly rollover, but idle outside of the core hours. On the bright side, in this scenario at least logback can determine maxQ. 2. "the value of Q is independent of the length of the rollover period". It is, but I'd suggest that the value of maxQ, i.e. the max expected idle period, is a function of the rate of logging - which is often a function of the rate of rollover. Just trying to avoid the 1440 file scenario you highlighted.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- 1) "The application is typically not used at the weekend - so for two days a week the application is running but there is no logging activity. I can't believe that's an especially unusual scenario." You are right. The scenario is perfectly plausible for an application deployed in the context of a business with clearly defined opening hours. You'd need a heartbeat thread logging at regular intervals to overcome this problem. 2) If the value of Q is independent of the duration of the rollover period, so is maxQ. It would be incorrect to make it dependent just because it suits us better.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Joern Huxhorn commented on LBCORE-147: -------------------------------------- What about appenders that are configured to only log errors? I wouldn't want to log an error event as a heartbeat just to get the rolling right.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- Would you be doing rolling for just error logs?
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- For applications without logging activity for a prolonged time, it would be quite possible to detect such inactivity and react accordingly without requiring a heart beat.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Alexander Lauper commented on LBCORE-147: ----------------------------------------- Thank you Ceki for looking into this matter. This comment got longer than I wanted, sorry for that ... The assumption that at least one LoggingEvent is generated per rollover period does not hold for my app as well. As a matter of fact if the device is running flawlessly there could be quiescent periods of multiple days if not even months. Hence I am thinking of scheduling a job which logs free memory and disk space once a rollover period to avoid having gaps in log files ... I am not too happy with the maxQ-solution. This would work in most of the cases, yes. But I'd rather prefer a solution which always works (well, who doesn't ...). Three things which crossed my mind: 1) How is the problem solved in other logging frameworks? I guess we aren't the only ones thinking about this ... 2) How about scanning all files recursively and cleanup on appender start only and keep the existing deletion mechanism? Then you define that it's the application developpers responsibility to log at least once a rollover period. This would work when the device/machine/app is not running for an undefined duration. Quiescent periods longer than the rollover period wouldn't exist anymore when following the constraint mentioned. If one is not happy with having unneeded log entries the policy class could provide a method to trigger a rollover (if the conditions for a rollover are met) but not adding a log entry (maybe that exists already?). 3) Another approach would be something already mentioned by Dieter Mueller (logback needs to keep track of created log files). However I'd prefer if the history wasn't stored in a seperate file, but rather be kept in memory an generated on appender start. Kind regards, Alex
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Greg Thomas commented on LBCORE-147: ------------------------------------ I'm still worried about relying on the application to log frequently; Unless I've missed something ... a) It means two different file deletion mechanisms to maintain within LBCORE; one at startup, one at rollover time. b) The application will have to parse the logging configuration, and determine the current logging level and frequency to determine if a new log entry has of sufficient level has occurred sufficiently recently, and then create a "please ignore this" log entry at a high enough level to trigger a new rollover. c) Any application checking for log entries to alarm will need to be altered to ignore the "please ignore this" log entry.
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Alexander Lauper commented on LBCORE-147: ----------------------------------------- Greg, 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, Alex
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- The archive removal algorithm now [1] properly deals with stop/restarts as long as the time difference is not over 64 days. For applications not generating logs, the (logging) inactivity period can be arbitrarily long. As long as there is a single log activity archives will be removed correctly. [1] http://github.com/ceki/logback/commit/524e0fc13ecc4fb24d
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu resolved LBCORE-147. ------------------------------- Fix Version/s: 0.9.30 Resolution: Fixed
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 Fix For: 0.9.30
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Bruce E. Irving commented on LBCORE-147: ---------------------------------------- I have downloaded Logback version 0.9.30 which is supposed to fix this issue; but I have a usage scenario for which this is still broken. The application is a desktop utility which users may run several times during the day or it may go unused for long periods. I wanted to collect the logs for a given day in a date stamped file and to save a few days and automatically delete older files. For the datestamp requirement, the FileAppender would work, but to delete older files the RollingFileAppender seemed appropriate. I am not compressing old files, so that is not an issue. I am not providing the FileAppender.file property, so each days logging goes directly into the file with today's date, and there is no need for file renaming. As far as I can tell, the 'rolling' logic that would delete the old files is never run. The application is almost never running at midnight, so it would have run at startup and does not. I found what I believe is the source of the issue in TimeBasedFileNamingAndTriggeringPolicyBase: public void start() { ... setDateInCurrentPeriod(new Date(getCurrentTime())); if (tbrp.getParentsRawFileProperty() != null) { File currentFile = new File(tbrp.getParentsRawFileProperty()); if (currentFile.exists() && currentFile.canRead()) { setDateInCurrentPeriod(new Date(currentFile.lastModified())); } } addInfo("Setting initial period to " + dateInCurrentPeriod); computeNextCheck(); } Since there is no parentsRawFileProperty, this uses the current time and sets the next check at midnight tonight. Therefore the check is not run at startup, and in my case is never run. This would work fine if dateInCurrentPeriod was set to anything before today. I would suggest the following change: public void start() { ... File currentFile = new File(tbrp.getActiveFileName()); // Use same logic if ParentsRawFileProperty is set or not. if (currentFile.exists() && currentFile.canRead()) { setDateInCurrentPeriod(new Date(currentFile.lastModified())); } else { setDateInCurrentPeriod(0); // No current file found, force a triggering event // or if the above is too brute-force: setDateInCurrentPeriod(rc.getRelativeDate(new Date(), -1)); } addInfo("Setting initial period to " + dateInCurrentPeriod); computeNextCheck(); }
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 Fix For: 0.9.30
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- Bruce, it seems to me that the use case you are describing is a little different. In your scenario, the application never rolls over because it is not running at the beginning of the subsequent period. Could you please enter a new issue so that your case can be dealt with separately?
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 Fix For: 0.9.30
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Shaun thompson commented on LBCORE-147: --------------------------------------- I'm currently referencing the latest logback 0.9.30 version and I'm not seeing my log history deleted correctly. Possible configuration issue? Here's my log policy <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>XXX.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- rollover daily --> <fileNamePattern>XXX-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <MaxHistory>7</MaxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>5MB</maxFileSize> <MaxHistory>3</MaxHistory> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <encoder class="CustomPatternLayoutEncoder"> <pattern>[%p] [%d{ISO8601}] [%ip_address] [%user_id] [%c] [%m]%n</pattern> </encoder> </appender> Here's a history of the log files that are still out there. XXX-2011-08-26.0.log XXX-2011-08-29.0.log XXX-2011-08-30.0.log XXX-2011-09-09.0.log XXX-2011-09-16.0.log XXX-2011-09-23.0.log XXX-2011-09-27.0.log XXX-2011-09-28.0.log XXX-2011-09-29.0.log XXX-2011-09-30.0.log XXX-2011-10-02.0.log XXX-2011-10-03.0.log
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 Fix For: 0.9.30
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Ceki Gulcu commented on LBCORE-147: ----------------------------------- Shaun, could you provide more detail about your application. In particular, how frequently is your application started/stopped. Do you think you are in the same scenario as the one described in LBCORE-226 ?
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 Fix For: 0.9.30
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

[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.i... ] Shaun thompson commented on LBCORE-147: --------------------------------------- That could definitely be a possibility. The logs I'm looking at are for a development application so the start/stop frequency varies widely - anywhere from several times a day to once in a couple of weeks.
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 Fix For: 0.9.30
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
participants (11)
-
Alexander Lauper (JIRA)
-
Anton Kudinov (JIRA)
-
Bruce E. Irving (JIRA)
-
Ceki Gulcu (JIRA)
-
Dieter Mueller (JIRA)
-
Eric Roberts (JIRA)
-
Greg Thomas (JIRA)
-
HC (JIRA)
-
Joern Huxhorn (JIRA)
-
Rafael Diaz Maurin (JIRA)
-
Shaun thompson (JIRA)