Profile Image
vishnupriya

What is Java Error File: -XX:ErrorFile?

What is Java Error File: -XX:ErrorFile? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvm-argument

  • xx-errorfile

  • x-errorfile

  • Java Error File

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

• -XX:ErrorFile=<filename>

 

The filename parameter may contain the special sequence %p, which is replaced by the process identifier of the JVM process.

 

Example:

java -XX:ErrorFile=./java_error.log

 

Specifies that error data should be written to java_error.log in the current working directory of the Java process.

 

Linux/MacOS example: java -XX:ErrorFile=/var/log/java/java_error_%p.log

 

Writes error data to the system /var/log/java/ folder, with the file name containing the identifier of the Java process.

 

Windows example:

 

java -XX:ErrorFile=C:\log\java\java_error_%p.log Writes error data to the system C:\log\java folder, with the file name containing the identifier of the Java process.

 

Description:


The -XX:ErrorFile option controls where error data is written when the JVM
crashes due to an unrecoverable error. This data may be useful to analyse the
causes of the crash.


To obtain more information in this file, the -XX:+ExtensiveErrorReports flag
can be enabled.


If the specified file is not writeable then the file is created in the temporary
directory for the operating system. On Linux and MacOS the temporary directory
is /tmp. On Windows it is the value of the TMP environment variable.

 

Default Value:

The default value of -XX:ErrorFile is:

 

-XX:ErrorFile=./hs_err_pid%p.log

 

meaning that error data is written to the current working directory with the name hs_err_pid.log, where is substituted with the identifier of the Java process.

 

Errors:


None


Arguments Related to -XX:ErrorFile:


TODO: link to -XX:+ExtensiveErrorReports TODO: link to -XX:OnError
TODO: link to -XX:OnOutOfMemoryError


NOTE:


If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xx-errorfile

  • x-errorfile

  • Java Error File