Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is default jvm error log location?

Tags:

java

If an error log location isn't specified when executing java -cp ../blah someplace/somejar.jar where would the jvm error log be written to?

like image 262
blank Avatar asked Dec 31 '12 13:12

blank


2 Answers

What do you mean by "jvm error"? If you refer to stack-traces, these are written to System.err which leads to the standard error stream. This is typically printed in your terminal, just as System.out is. You can redirect this if you want, either when calling the JVM (using 2> /my/file.log) or from within your code by redirecting System.err.

Some logging frameworks redirect the std-error, then it depends on your configuration.

If you refer to JVM Crash logs (which are created if the JVM crashes, which should never happen if you do not use JNI, but in fact they sometimes occur) the situation is different. These are typically created in the folder where the jvm was launched. If this folder is not writable, the /tmp directory is used on Unix-Systems.

like image 97
theomega Avatar answered Sep 28 '22 01:09

theomega


According to Java Platform, Standard Edition Troubleshooting Guide: Location of Fatal Error Log, the system attempts to create the file in the working directory of the process if the -XX:ErrorFile=file flag is not specified.

In the event that the file cannot be created in the working directory (insufficient space, permission problem, or other issue), the file is created in the temporary directory for the operating system.

  • On Oracle Solaris and Linux operating systems the temporary directory is /tmp.

  • On Windows the temporary directory is specified by the value of the TMP environment variable; if that environment variable is not defined, the value of the TEMP environment variable is used.

like image 43
Baumann Avatar answered Sep 28 '22 00:09

Baumann