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:
- Java 6 Update 34
- Java 7 Update 2 (but there is no reference to it in these release notes)
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.