Configure JVM Garbage Collection Logging

Posted 04/10/2017 2:26 PM by Corey Klass

When your application gets to be a certain size, you'll have to enter the world of Java Garbage Collection, and analyzing memory usage to better determine needs and improve performance.

Part of that analysis is enabling Garbage Collection logging, so that you can then run the log through an analysis tool like GCEasy.io to get an idea of what's going on.

Add the following JVM options to the end of your launch string. In the example below, the file that's generated will be called gclog.txt.

-XX:+PrintGCTimeStamps
-verbose:gc
-XX:+PrintGCDetails
-Xloggc:gclog.txt