I have the following logging problem with several Java applications using log4j for logging:
I want log files to be rotated daily, like
I came across this appender here that does what you want, it can be configured to keep a specific number of files that have been rolled over by date.
Download: http://www.simonsite.org.uk/download.htm
Example (groovy):
new TimeAndSizeRollingAppender(name: 'timeAndSizeRollingAppender',
file: 'logs/app.log', datePattern: '.yyyy-MM-dd',
maxRollFileCount: 7, compressionAlgorithm: 'GZ',
compressionMinQueueSize: 2,
layout: pattern(conversionPattern: "%d [%t] %-5p %c{2} %x - %m%n"))