Tomcat console log to a file

Hariprasath picture Hariprasath · Oct 14, 2014 · Viewed 25.4k times · Source

Im using Apache Tomcat 7. When I'm running Tomcat with security manager and with the -Djava.security.debug parameter I'm getting so much of text in console. I can't read the text in console. So I need the console log into some file. How can I achieve this?

Answer

user1134181 picture user1134181 · Oct 14, 2014

Remove ConsoleHandler from logging configuration. In conf/logging.properties:

Change this -

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

To this -

.handlers = 1catalina.org.apache.juli.FileHandler

The logs will be in the file catalina.log.


If you want to disable console logging for selected applications, you can set swallowOutput in true in the <Context> element.

...
<Context path="..." swallowOutput="true"> 
...