[logback-user] maxHistory doesnt delete older files properly
Raman, Kalyan
Kalyan.Raman at morganstanley.com
Thu Mar 24 22:26:34 CET 2011
Hi,
We were using logback's 'ConsoleAppender' for couple of our projects which was working good.
Recently we are trying to use the 'RollingFileAppender' with 'timeBasedFileNamingAndTriggeringPolicy' and class "ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP" and facing issues with the deleting of the older archived files.
Issue is that it doesn't always delete files older than the max history period when there is considerable time gap between the logging events.
I can see many people raising this issue but couldn't find any information that this is resolved in any particular release. We are using the 0.9.17 and 0.9.24 versions and this problem occurs in both the versions.
Below are the appender configurations of both the projects with the logback release versions used.
Project 1: -------------------------------------------------
Uses logback-core 0.9.17
<appender name="ROLLING_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/tmp/GcrDBS/test/dbs.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/var/tmp/GcrDBS/test/dbs.log.%d{yyyy-MM-dd_HH-mm}.%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>500KB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>6</maxHistory>
</rollingPolicy>
<layout name="stdLayout" class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{MMM dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
Project 2: -------------------------------------------------
Uses logback-core 0.9.24
<appender name="ROLLING_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/tmp/GcrWFC/test/dbs.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/var/tmp/GcrWFC/test/dbs.log.%d{yyyy-MM-dd_HH-mm}.%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100KB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>5</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{MMM dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
Could someone please let me know if this is fixed in any release? And if so what is that? Or any work around for this?
Thanks in advance.
Kalyan
--------------------------------------------------------------------------
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers. If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20110324/7038caad/attachment-0001.html>
More information about the Logback-user
mailing list