Throw exceptions in Tomcat for printing to localhost. [Date] .log instead of catalina.out

I am running tomcat 6.0.20 (with spring, if that matters) and it seems that it cannot get stack traces from uncaught exceptions thrown from my code to print on catalina.out.

I am trying to simulate the output you see on the eclipse console. When I deploy war on a production server and run tomcat, most of the output goes to catalina.out, but stack traces from the exceptions thrown inside my own code go to tomcat / logs / localhost. [Date] .log.

How can I get all the relevant entries for entering a single file (similar to the eclipse console)?

I start the server just by running tomcat / bin / startup.sh

+6
source share
1 answer

Edit TOMCAT_HOME/conf/logging.properties

By default, for the catalina log of catalina there will be directories .log and localhost logging to localhost.log

as below

 1catalina.org.apache.juli.FileHandler.level = ALL 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 1catalina.org.apache.juli.FileHandler.prefix = catalina. 2localhost.org.apache.juli.FileHandler.level = ALL 2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 2localhost.org.apache.juli.FileHandler.prefix = localhost. 

Make your choice and edit .prefix to specify the one you want.

The update to catalina.out explicitly referenced, as shown below, at the beginning of the catalina.sh script (but not in bat bat files), so I cannot see the .out file in windows, but only on * nix systems

"$CATALINA_BASE"/logs/catalina.out 2>&1

Personally, I prefer Catalina engine logs to be separate from application logs

+3
source share

All Articles