开发者

How do we generate stack trace in TOMCAT?

How do we generate stack trace in TOMCAT? My real problem is TOMCAT just stops after doing some funct开发者_JAVA技巧ion call defined in some library. It would be easy to debug with a stacktrace.


There's multiple things you can do. I'm assuming below you are talking about a Java stack trace.

In linux, you can generate a stack trace at any time by doing a kill -3 command

ps aux | grep tomcat --> gives you the process number

kill -3 1000 --> where 1000 is the process number

In Windows, right click on the Tomcat service icon in the system task tray and choose "Thread dump".

If you want to generate a stack trace at a particular point in the code

Throwable t = new RuntimeException();
t.printStackTrace();

All of the above will send a stack trace to standard out.

Finally, you can run a profiling program like VisualVM and see the stack trace for any given thread while the program is running.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜