开发者

How to log exceptions from a specific package deployed in tomcat

I'm forced to use custom closed source lib in my web app deployed in tomcat 6. It is logging a lot of exceptions in my stdout log (catalina.out) via printS开发者_开发百科tackTrace and then rethrowing them for me to handle. Is there a way to prevent or reroute logging of exceptions from a specific package deployed in webapp?


e.printStackTrace prints to the console similar to System.err

In Tomcat, the catalina.sh has this line which redirects all console errors to catalina.out This applies for the Tomcat server as a whole.

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

So in short, if you cant tinker with the source code to use log4j, you could try sending this to another file within the catalina.sh, but again this would not be package specific as you want.

And this would just bloat another file in a similar manner.


How about calling that segment within a try/catch segment, thus catching the exception before your app dies, adding it to log4j (or any other logging mechanism)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜