When logging compilation on hotspot when running under -XX:+LogCompilation -XX:LogFile=/path/to/file.log logs get written to /path/to/file.log which is good, but also different (much more) logs are written to two /tmp/hs_c<someid>_pid<mypid>.log files, which I didn't expect. When terminating the application, one of those files gets deleted, but the other stays there.
What's going on, and how can I keep the logging to the given log file but stop the logging to the /tmp files?
When
-XX:+LogCompilationis on, HotSpot logs global compilation events (e.g., when a new compilation task is submitted or when a new compiled method is created) as well as detailed compilation activity of each compiler thread.To avoid mixing up concurrent output of compiler threads, each thread writes its own log to a dedicated temporary file, which gets merged into
LogFileafter this thread terminates or when the JVM exits./tmp/hs_cNNN.logfiles are these per-thread logs. A file may remain undeleted if the JVM terminates abnormally.If you don't like the verbose output of
LogCompilation, try-XX:+PrintCompilationinstead. Alternatively, enable Flight Recorder to get JIT-related events recorded in JFR format.