Tomcat: trace all (even catched) exceptions

不羁岁月 提交于 2020-01-16 18:14:08

问题


is it possible to trace all exceptions in Tomcat server (or, in general, JVM)?

Thanks for all!

P.S. I need it because exception occurs in org.primefaces.application.PrimeResourceHandler.handleResourceRequest() and a trivial message is printed (line 79)


回答1:


Sure. Start tomcat using that:

./catalina jpda start

And then connect using the eclipse debugger, as described here:

http://wiki.apache.org/tomcat/FAQ/Developing#Q1

When for example Eclipse is connected, go to the Breakpoints panel, there will be a button "Add Java Exception breakpoint" if you set java.lang.Exception or java.lang.RuntimeException there, all the subclasses will be caught.




回答2:


Globally the logging is either configured in

${catalina.base}/conf/logging.properties file or {java.home}/lib/logging.properties

You can change the trace level by uncommenting the following property and setting it to ALL.

org.apache.catalina.level=ALL

More Info: Documentation




回答3:


I am not aware of such a feature in the JVM.

I believe you wish so figure out the reason why that exception is being thrown, right? I would use an IDE such as Netbeans, include that library as a dependency, download the sources, and place a breakpoint on that line. Then, through the standard debugger, I would scan the stack trace when the breakpoint is hit to look for clues.



来源:https://stackoverflow.com/questions/11264133/tomcat-trace-all-even-catched-exceptions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!