When JVM crashes, Heap dump file(hs_err_pidXXXX.log) is created in the working directory. I want to know who creates this file. JVM crashed means it has terminated abnormally. So it will definitely not create this file. So how is this file created?

Also can we control the information displayed in this file. If I want to have thread dump and heap dump both together in a single file (hs_err_pidXXXX.log) is it possible? If yes how? Basically my priority is to identify the function(or stacktrace) that caused JVM to crash and store it on the Heap dump file that is created.

有帮助吗?

解决方案

Many operating systems allow a process to register a handler for certain exceptional conditions. For example in UNIX there is the concept of signals.

So it is possible that the JVM itself writes the log.

其他提示

You are getting a heap dump on crash already. To get a thread dump in addition, use the following JVM argument

 -XX:OnOutOfMemoryError="kill -3 %p"

Note: This will most likely create the thread dump in a different file or console though.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top