Can I force generation of a JVM crash log file?

爷,独闯天下 提交于 2019-12-17 16:28:03

问题


The log file from a JVM crash contains all sorts of useful information for debugging, such as shared libraries loaded and the complete environment. Can I force the JVM to generate one of these programmatically; either by executing code that crashes it or some other way? Or alternatively access the same information another way?


回答1:


You can try throwing an OutOfMemoryError and adding the -XX:+HeapDumpOnOutOfMemoryError jvm argument. This is new as of 1.6 as are the other tools suggested by McDowell. http://blogs.oracle.com/watt/resource/jvm-options-list.html




回答2:


Have a look at the JDK Development Tools, in particular the Troubleshooting Tools for dumping the heap, printing config info, etcetera.




回答3:


I am pretty sure this can be done with the IBM JDK as I was playing around with their stack analyzer some time ago. One option to force the dump would just to cause an outOfMemoryException.

These tools may provide some clues http://www.ibm.com/developerworks/java/library/j-ibmtools1/



来源:https://stackoverflow.com/questions/337793/can-i-force-generation-of-a-jvm-crash-log-file

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