Rolling garbage collector logs in java

Built-in support for GC log rotation has been added to the HotSpot JVM.
It is described in the RFE 6941923 and is available in:

There are three new JVM flags that can be used to enable and configure it:

  • -XX:+UseGCLogFileRotation
    must be used with -Xloggc:<filename>;
  • -XX:NumberOfGCLogFiles=<number of files>
    must be >=1, default is one;
  • -XX:GCLogFileSize=<number>M (or K)
    default will be set to 512K.

Leave a Comment