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.

3 Replies to “Tomcat installed as Windows service doesn’t create log files

  1. I am trying to generate log file on tomcat installed through installer. I am unable to create any kind of log file in tomcat logs folder while when i run development version of code, log file create in logs folder of tomcat and this tomcat bind through eclipse.
    If i am facing same issue as you described than why there is need for a service?

  2. One thing worth to mention that both tomcat are different. One that is bind with eclipse is different and on different machine. Actually i create a war file and deploy that war file on tomcat created through tomcat installer and tries to create log file in logs folder and unable to do.

  3. Need for service? Typically when you need to bundle Tomcat into custom installer and register it as service with custom settings.

Comments are closed.