Hi, //----- property file snippet .. .. log4j.appender.rollingFile=org.apache.log4j.DailyRollingFileAppender log4j.appender.rollingFile.File=mylog .. .. //----------------------------- I am using DailyRollingFileAppender which works fine.. Is there any 'property' that can be set so that files older than x days are removed automatically? I cannot use RollingFileAppender which would have done the job for me..
Instead of trying to modify the appender so that it deletes old files, why don't you just write a separate piece of code which you run daily? Since the java.io.File class contains methods for getting all files in a directory and finding out when they were last changed, it's very easy to write something which deletes all files in a directory which are more than X days old.
subject: log4j - DailyRollingFileAppender - Deleting 14 day old files automatically