Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught exceptions in Tomcat print to localhost.[date].log instead of catalina.out

I'm running tomcat 6.0.20 (with spring, if that matters) and can't seem to get stack traces from uncaught exceptions thrown from within my code to print to catalina.out.

I'm trying to mimic the output that you see in the eclipse console. When I deploy a war on a production server and start tomcat, most of the output goes to catalina.out, but stack traces from exceptions thrown within my own code goes to tomcat/logs/localhost.[date].log.

How can I get all of the relevant logging to go to one file (similar to eclipse's console)?

I'm starting the server by simply running tomcat/bin/startup.sh

like image 979
Keith Avatar asked Oct 27 '10 04:10

Keith


People also ask

What is the difference between Catalina out and Catalina log?

Catalina. out contains almost everything in the log including something more. It might be useful to post the config files, the tomcat version of the log4j in conf and also your applications config of log4j usually in root of your webapp's classpath.

Where is the Catalina out file in tomcat?

By default, the catalina. out file is located in the logs directory under Tomcat's root directory. For example, /opt/netiq/idm/apps/tomcat/logs/catalina.

What is Catalina out file in tomcat?

Catalina. out simply contains everything that is written to Tomcat's "System. out" and "System.


1 Answers

Edit TOMCAT_HOME/conf/logging.properties

The default would have the catalina engine log to catalina.log and the localhost logging to localhost.log

like 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.

Take your pick and edit .prefix to point to the one you want.

Update catalina.out is explicitly referenced as shown below in the catalina.sh start script (but not in the corresponsing bat files) - which is why I dont see the .out file on windows but only on *nix systems

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

Personally I prefer the Catalina engine logs being separate from my application logs

like image 64
JoseK Avatar answered Oct 22 '22 08:10

JoseK