I have the following logging problem with several Java applications using log4j
for logging:
I want log files to be rotated daily, like
There is another option DailyRollingFileAppender. but it lacks the auto delete (keep 7 days log) feature you looking for
sample
log4j.appender.DRF=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DRF.File=example.log
log4j.appender.DRF.DatePattern='.'yyyy-MM-dd
I do come across something call org.apache.log4j.CompositeRollingAppender, which is combine both the features of the RollingFileAppender (maxSizeRollBackups, no. of backup file) and DailyRollingFileAppender (roll by day).
But have not tried that out, seems is not the standard 1.2 branch log4j feature.