[logback-dev] [JIRA] Commented: (LBCORE-147) RollingPolicy MaxHistory not deleting old files
Greg Thomas (JIRA)
noreply-jira at qos.ch
Thu Aug 25 18:59:16 CEST 2011
[ http://jira.qos.ch/browse/LBCORE-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12093#action_12093 ]
Greg Thomas commented on LBCORE-147:
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">
> <RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
> <layout class="ch.qos.logback.classic.PatternLayout">
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