DJClayworth
DJClayworth

Reputation: 26856

Can I force generation of a JVM crash log file?

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?

Upvotes: 11

Views: 10820

Answers (4)

gmode
gmode

Reputation: 3740

On Ubuntu 20.04.1 LTS I force core dump on jdk 11 process via

kill -4 <PID>

Upvotes: 1

ghbuch
ghbuch

Reputation: 114

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

Upvotes: 8

McDowell
McDowell

Reputation: 108879

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

Upvotes: 2

Karl
Karl

Reputation:

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/

Upvotes: 0

Related Questions