1. June 2013

Tomcat installed as Windows service doesn’t create log files

I was chasing one very insidious bug. Tomcat installed as Windows service was not creating logs. The only log produced by Tomcat was stdout and stderr from procrun wrapper.

It was very weird. Tomcat downloaded from Apache’s website was creating logs without problem. There was no difference between directories of problematic Tomcat and working Tomcat.

Ok, let’s cut long story short. After several attempts to locate the bug I realized that Tomcat started by startup.bat was working correctly.

The only difference was in the Tomcat’s start method.

It was necessary to open Tomcat service properties (ES stands for Edit Service):

tomcat7w.exe \\ES\\tomcatweb

The tricky part here was not to check the Logging tab. This issue had nothing to do with stuff displayed in Logging tab. It was necessary to open Java tab.

When I compared working service and Tomcat service without logging I found that following lines were missing:

-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\projects\apache-tomcat-7.0.40\conf\logging.properties

tomcat-edit-windows-service

Somebody who was registering the service just omitted those lines when overriding –JvmOptions. It was sufficient to add java.util.logging.manager and config.file. Restart service and Tomcat was logging without problem.