GC log rotation
When GC logging is enabled using the
-Xverbosegc or
-Xloggc option, by default, the GC data is written to a single log file of unlimited size. NSJ allows you to control the size and number of the GC log files. The GC log records are written in the specified number of GC log files in a round-robin method. This allows GC data to be archived easily and thus helps to limit the amount of disk space consumed by the GC log files. Log rotation is also supported when using zero-preparation
-Xverbosegc.
To enable log rotation, use the following option along with
-Xverbosegc,
-Xloggc, or zero-preparation
verbosegc:
-XX:GCLogLimits=M,N
Mis a non-negative integer that specifies the number of rotating GC log records per file. A value of 0 specifies unlimited number of GC log records per file.
NOTE:Each GC log record corresponds to a GC event.
Nis a non-negative integer that specifies the maximum number of rotating GC log files. A value of 0 specifies unlimited number of files.
You must use both
M and
N when you use the
-XX:GCLogLimits=M,N option. If this option is not specified, the default behavior is to write a single GC log file with unlimited size.
When rotation is in effect, a sequence number is appended to the GC filename (0 through N-1). For example,
filename.0,
filename.1, and
filename.2.
With log rotation, when the specified maximum number of files (N) is reached, logging cycles back to the first file in the sequence
(filename.0), thereby overwriting the old GC data with new data. If the maximum number of files (N) is never reached, then no log rotation occurs.

