When experiencing performance issues with the Java runtime, looking at gc logs is often the first thing we can do. However, the settings of different versions of Java will be slightly different.

JDK 1.8

Enable the log information and records it in the gc.log file.

1
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -verbose:gc -Xloggc:./gc.log
TAGS