JVM线程转储位置 [英] JVM thread dump location
本文介绍了JVM线程转储位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我向我的Java程序发出 kill -3< pid>
命令时,它会在控制台上生成线程转储。如何将其重定向到文件?
When I issue a kill -3 <pid>
command to my Java program, it generates the thread dump on the console. How do I redirect this to a file?
推荐答案
两个选项:
使用重定向的stdout运行Java应用程序
java com.example.MyApp > out.txt
使用 jstack
相反。
Use jstack
instead.
jstack 实用程序允许您获取线程转储并将输出发送到当前控制台而不是Java应用程序的stdout,允许您重定向它。
The jstack utility allows you to get a thread dump and send the output to the current console instead of the stdout of the Java application, allowing you to redirect it.
例如,如果Java应用程序的PID是12345(使用 jps 实用程序可以快速找到它:
For example, if the PID of your Java application is 12345 (use the jps utility to find it quickly):
jstack 12345 > threads.txt
这篇关于JVM线程转储位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文