On Jan 20, 2008, at 3:42 PM, Manish Marathe wrote:
Hello All,
Currently the Appender, DailyRollingFileAppender, rolls over the log
file as per the "datePattern" set in the configuration file,
although the rolled-over files never get deleted unlike if we use
RollingFileAppender but in case of RollingFileAppender we cannot use
the datePattern.
In one of our products in my company, SpikeSource Inc, I needed a
feature to delete the rolled over oldest files so I extended
DailyRollingFIleAppender.java to add SET and GET methods for
maxBackupIndex, one of the parameters we can set in the
configuration file, and implemented and the deletion of rolled over
"oldest".
I would be happy to give this back to log4j community unless someone
has already added the feature.
I am a developer from SpikeSource Inc and I plan to blog about it on http://developer.spikesource.com
and make it available from there but its better to include in the
library itself and make it available to the whole community.
Actually the feature add and implementation is so simple and less of
a code, if given permission I can actually modify
DailyRollingFileAppender.java and give it back.
Hopefully this will be helpful to someone.
Thanks
Manish
SpikeSource, Inc
http://developer.spikesource.com
http://www.spikesource.com
It would be interesting to hear your approach. It has been a
frequently asked enhancement, but the flexibility of using date
patterns made implementing an algorithm to find the
"oldest" (particularly for patterns that omitted significant portions
of the date) difficult to do in a way that would work consistently.
The best place for such an enhancement would be in "extras" companion (http://logging.apache.org/log4j/companions/extras
) which is a collection of new features and enhancements that can be
used with log4j 1.2.x deployments (back to at least 1.2.9, but may
work back further). The extras has the
org.apache.log4j.rolling.RollingFileAppender (notice the
extra .rolling. in the package name) framework that was back-ported
from the abandoned log4j 1.3 development. It would be best to do any
enhancement in that framework instead since it already addresses many
issues with the main-line RFA and DRFA.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]