log4j and deleting old log files using DailyRollingAppender

A

Alessandro

I've read that default DailyRollingAppender doesn't support deleting
old files older than a certain date

Then I have downloaded and integrated class CompositeRollingAppender
inside log4j jar, which should have functions of FileAppender +
DailyRollingAppender and so also the property MaxSizeRollBackups.

This property should set a max number of log files, when more it
deletes.

Problem is that it doesn't delete when I have more files than
threshold set in MaxSizeRollBackups (e.g. 5).

This is the log4j property file I'm using:

//START
log4j.rootLogger=DEBUG, LOGFILE
log4j.logger.org.springframework=OFF
log4j.logger.org.quartz=OFF


log4j.appender.LOGFILE=org.apache.log4j.CompositeRollingAppender
log4j.appender.LOGFILE.Threshold=DEBUG
log4j.appender.LOGFILE.File=./log/Log.log
log4j.appender.LOGFILE.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.LOGFILE.MaxSizeRollBackups=5
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{yyyy-MMM-dd
HH:mm:ss} %5p %C (line:%L) - %m%n
/FINE


Any idea ??

thanks and best rgds

Ale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top