4

I have wrote below configuration in my logging.properties:

2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.maxDays=5
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.

Logs write in log file perfectly but maxDays properties is not working. Means I have manually run my application after changing date up-to 6 days but log file not deleted after maxDays is reach.

Description of maxDays properties on https://tomcat.apache.org/tomcat-8.5-doc/logging.html: By default the log files will be kept on the file system forever. This may be changed per handler using the handlerName.maxDays property. If the specified value for the property is <=0 then the log files will be kept on the file system forever, otherwise they will be kept the specified maximum days.

Can you please help to verify applied configruation is correct or not ? or I understood maxDays properties usage wrong.

Hkachhia
  • 4,130
  • 5
  • 35
  • 71

1 Answers1

3

Needs new Tomcat version

Same problem here. Currently I'm using Tomcat 8.5.4. I found this link mentioning that I will need version 8.5.16 or higher to use this feature.

https://bz.apache.org/bugzilla/show_bug.cgi?id=61105#c14:

The new functionality was back ported to:
- 8.5.x for 8.5.16 onwards
- 8.0.x for 8.0.45 onwards
- 7.0.x for 7.0.79 onwards

For details see entries tagged "61105" in changelogs:

StackzOfZtuff
  • 1,671
  • 18
  • 19
FkJ
  • 1,499
  • 1
  • 15
  • 29
  • In 8.5.16 changelog, I see a fix in JULI FileHandler for specifying the maximum number of days to keep the log files. – Hkachhia Oct 12 '17 at 11:06