Usage:
This flag allows the JVM to rotate written on Garbage Collector log.
Since:
Starting from JDK 6.
Removed:
Since from JDK 9.
Examples:
To enable:
java -XX:+UseGCLogRotation
Description:
Garbage Collector (GC) is a way of the JVM to clean the memory and makes the java memory more efficient. It tracks (Mark step) and removes (sweep step) every unused object available in the JVM heap space. An object is considered unused when it’s referenced by null, assigned to another reference or by anonymous object.
Log rotation is a process where the log files are renamed, archived, compressed or deleted when they are large and new logs are written directly to a new log file.
To analyze JVM performance, you must look at the Garbage Collector (GC) log because they are essential to understand your application performance and see what causes memory issues. The logs can be generated with the flag “Xloggc”. However, the GC log file will grow in size while the JVM is still running and it might cause issues. Luckily, JVM introduced some arguments to manage the GC logs such as rotating and sizing them. One of these flags is “UseGCLogRotation” which enables GC log rotation.
Default Value:
By default, this flag is disabled.
Note:
It must be used with the flag “-Xloggc:filename”
Arguments related:
Xloggc, NumberOfGClogFiles, PrintGCDetails, PrintGCDateStamps, PrintGCTimeStamps, PrintGCCause, UseGCLogFileRotation, GCLogFileSize
Related Posts:
Edit your Comment