开发者

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

开发者 https://www.devze.com 2023-01-21 08:19 出处:网络
I\'m running tomcat 6.0.20 (with spring, if that matters) and can\'t seem to get stack tracesfrom uncaught exceptions thrown from within my code to print to 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 wi开发者_JAVA技巧thin 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消