0

In tomcat/logs directory we have different set of files which are normally rotated everyday. Is there any procedure to override rotating mechanism for catalina.out, localhost_access_log, manager.${DATE}.log, host-manager.${DATE}.log I don't want to rely on logrotate utility as there is a chance of losing data in log files. After reading couple of articles there is one way to create a new file by adding some configurational changes in tomcat/conf/server.xml file

<Valve
className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="catalina."
suffix=".out"
pattern='%a %A %b %B %h %l %m %p %q %u %t "%r" %s %U %D %S'
resolveHosts="false"
rotatable="true"/>

this piece of configuration does not fulfill my requirement. tomcat/conf/log4.properties changes do not work for me.

your support is highly appreciated. Thanks.

Umair
  • 860
  • 2
  • 13
  • 30
  • Maybe you can extend the `org.apache.juli.FileHandler` and override the `publish` where the log file is rotated on first wirte after midnight. Then [configure your custom FileHandler as tomcat default](https://stackoverflow.com/questions/14590330/custom-java-util-logging-handler-in-tomcat#20384327) – Selaron Mar 29 '19 at 10:09
  • @Selaron what if i define new handler in log4j.properties and change all the catalina logging properties. will it work? – Umair Apr 02 '19 at 11:00

0 Answers0