JVM Garbage Collection Logging

This chapter provides tutorial notes and example codes on JVM options for garbage collection logging. Topics include a summary of logging options; examples of log messages for '-Xlog:gc', '-Xlog:gc:file', -Xlog:gc=trace', '-Xlog:gc+heap=trace', '-Xlog:gc*=trace', etc.

Garbage Collection Demo Program

Garbage Collection Logging Options

"-Xlog:gc" - Default GC Logging Level: INFO

"-Xlog:gc=trace" - Lowest GC Logging Level: TRACE

"-Xlog:gc+heap=trace" - GC+HEAP Log Messages

"-Xlog:gc*=trace" - Maximum GC Logging

"-XX:+PrintFlagsFinal" - Print JVM Options


Note that GC logging options have been changed since JVM 9. Tutorials in the chapter apply to JVM 9 and newer versions. See tutorials in the next chapter on GC logging options for JVM 8 and older versions.

Table of Contents

 About This Book

 Heap Memory Area and Size Control

JVM Garbage Collection Logging

 Introduction of Garbage Collectors

 Serial Collector - "+XX:+UseSerialGC"

 Parallel Collector - "+XX:+UseParallelGC"

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 Garbage First (G1) Collector - "+XX:+UseG1GC"

 The Z Garbage Collector (ZGC) - "+XX:+UseZGC"

 Object References and Garbage Collection

 Garbage Collection Performance Test Program

 Performance Tests on Serial Collector

 Performance Tests on Parallel collector

 Performance Tests on Concurrent collector

 Performance Tests on G1 collector

 Garbage Collection Performance Test Summary


 Full Version in PDF/EPUB