Tomcat – How rotate TomCat 6 logs on Windows every night

log-filestomcatwindows-server-2003

Our Tomcat 6 is running on a Windows Server 2003 server producing some logs on Program Files\Apache Software Foundation\Tomcat 6.0\logs folder.

Only catalina.YYYY-MM-DD.log rotates every night.

Files Admin, Host-Manager, Jakarta, LocalHost, Manager, stderr and stdout do not rotate and are dated at the last server restart date. These files are most empty and always locked.

How can I set Tomcat to rotate all these logs every night (if possible without server/service restart)?

Thank you in advance for help.

Best Answer

In Linux (and FreeBSD) we have logrotate. On Windows, I think you can compile its source against Cygwin.

logrotate source: https://fedorahosted.org/logrotate/

Cygwin installer: http://www.cygwin.com

Tip for compiling logrotate on Cygwin: http://cygwin.com/ml/cygwin/2009-11/msg00856.html