Java GC Tutorials - Herong's Tutorial Examples - v1.11, by Dr. Herong Yang
"-Xlog:gc=trace" - Lowest GC Logging Level: TRACE
This section describes the garbage collection logging option, '-Xlog:gc=trace', which prints out log messages from the GC channel at the TRACE level, which is lowest logging level.
In the second test, let's try the "-Xlog:gc=trace" garbage collection logging option to get more logging messages to the lowest level of TRACE in the log file:
herong> java -Xms2m -Xmx64m -Xlog:gc=trace:gc.log GarbageCollection Step/TotalMemory/FreeMemory/UsedMemory: 1 2031616 698848 1332768 2 3874816 1473392 2401424 3 3874816 425688 3449128 4 8970240 4442016 4528224 ... (Ctrl-C) herong> more gc.log [0.005s][trace][gc] MarkStackSize: 4096k MarkStackSizeMax: 16384k [0.013s][debug][gc] ConcGCThreads: 2 offset 16 [0.013s][debug][gc] ParallelGCThreads: 8 [0.013s][debug][gc] Initialize mark stack with 4096 chunks, maximum 16384 [0.014s][info ][gc] Using G1 [0.032s][info ][gc] Periodic GC disabled ... [0.584s][info ][gc] GC(34) Pause Young (Normal) (G1 Evacuation Pause) ... [0.587s][info ][gc] GC(35) Pause Young (Normal) (G1 Evacuation Pause) ... [0.590s][trace][gc] GC(36) Restored 3175 marks ... [0.590s][info ][gc] GC(36) To-space exhausted ... [0.590s][info ][gc] GC(36) Pause Young (Normal) (G1 Evacuation Pause) ... [0.590s][info ][gc] GC(27) Pause Cleanup 63M->63M(64M) 0.065ms ... [0.593s][trace][gc] GC(37) Restored 10478 marks ... [0.593s][info ][gc] GC(37) To-space exhausted ... [0.593s][info ][gc] GC(37) Pause Young (Prepare Mixed) (G1 Evacuation ... [0.594s][debug][gc] GC(38) Clear Next Bitmap 0.261ms ... [0.610s][trace][gc] GC(38) Restored 11390 marks ... [0.611s][info ][gc] GC(38) Pause Full (G1 Evacuation Pause) 63M->34M(6... [0.611s][info ][gc] GC(27) Concurrent Cycle 56.572ms ...
Obviously, "-Xlog:gc=trace" option is generating more logging messages. So you should use "=trace" all the time when troubleshooting any GC issues.
Table of Contents
Heap Memory Area and Size Control
►JVM Garbage Collection Logging
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
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