How can I output the safepoint log in a specified file?

Viewed 657

I am using java8 and I did set JVM argument to set GC log path,but the safepoint log did not output to the specified file and they still in my console output.What should i do to let the safepoint-log output to a file just like GC log?

1 Answers

In java-8 you need two flags : -XX:+LogVMOutput ( internally a safepoint is refered as vmop as in "vm operation", that is why the weird flag name, I guess ). To redirect the output to a file you need -XX:LogFile=path.

Since java-9, there is "unified logging" that makes this far more easy and intuitive, IMO. For example:

-Xlog:safepoint*=debug:file=safepoint.log
Related