7

I added the maxDays attribute to the AccessLogValve node of a Tomcat 7 server.xml, but access log files have not been deleted after restarting tomcat or restarting the Linux server. Am I missing something? The AccessLogValve config is:

    <Valve className="org.apache.catalina.valves.AccessLogValve" 
    directory="logs" 
    prefix="site_access." 
    suffix=".log" 
    maxDays="7" 
    resolveHosts="false" 
    pattern="%{org.apache.catalina.AccessLog.RemoteAddr}r %l %u" />
webber55
  • 329
  • 4
  • 13

1 Answers1

0

In case someone is still dealing with an ancient Tomcat installation: be aware that the maxDays property was only added in v7.0.86. This is not clear at all from the configuration docs or the Javadoc, i had to git-blame it myself from the repo.

In previous versions, you get this message in catalina.<date>.log :

WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Valve} Setting property 'maxDays' to '180' did not find a matching property.

Here is the commit that added the maxDays property:

https://github.com/apache/tomcat/commit/f9a4657b1d5b0284b1f6b99688db84ea273b8f28

And this is the related BugZilla entry (see comment 9):

https://bz.apache.org/bugzilla/show_bug.cgi?id=52688#c9

rom9
  • 11
  • 2