This answer implies that logs are kept for 7 days. Is this configurable?
This Java Ranch Post implies that files are never deleted.
This site also agrees that log files are never removed:
If you are trying to use the Apache Log4J DailyRollingFileAppender for a daily log file, you may need to want to specify the maximum number of files which should be kept. Just like rolling RollingFileAppender supports maxBackupIndex. But the current version of Log4j (Apache log4j 1.2.16) does not provide any mechanism to delete old log files if you are using DailyRollingFileAppender. I tried to make small modifications in the original version of DailyRollingFileAppender to add maxBackupIndex property. So, it would be possible to clean up old log files which may not be required for future usage.
I can't find an authoritative answer and I don't want to wait 7 days to see if my logs are deleted.
Best Answer
See this this post regarding Log4J deletes. In short it appears that dailyRollingFileAppender cannot. But perhaps you might want to look at switching to Logback. It was written by the same guy and can do what your looking for.
I use the following appender to maintain 30 days of HTML logs:
The relevant sectionfrom the manual states the following on
maxHistory
:Logback also has a Log4J properties translator available here to help with the transistion. As well as an entire chapter in their manual devoted to switching from Log4J.