[logback-dev] LBCORE-147 - deletion of old RollingPolicy log files

Greg Thomas greg.d.thomas at gmail.com
Mon Feb 21 17:09:06 CET 2011


There's a ticket open at http://jira.qos.ch/browse/LBCORE-147 that is
causing a problem for me; I'm willing to have a look at submitting a
patch for this, along the lines of the suggestion I made in the
ticket. I'll reproduce the comment I made here to save people looking
...

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

Is there a better solution? Would I be wasting my time looking at this?

Thanks,

Greg


More information about the logback-dev mailing list