Java Garbage Collection Logging

From NovaOrdis Knowledge Base
Revision as of 03:17, 13 February 2017 by Ovidiu (talk | contribs) (→‎-XX:+PrintGC)
Jump to navigation Jump to search

Internal

Command Line Options

Java 8

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BABFAFAE

Overview

In Java 8, GC logging is enabled with the -Xloggc:<file> (see below). The actual -XX values the JVM operates with are displayed at the top of the log file:

...
CommandLine flags: -XX:InitialHeapSize=268435456 -XX:MaxHeapSize=4294967296 -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC
...

Options

-Xloggc

-Xloggc:<file>

where <file> can be absolute or relative. In case of a relative path, it is relative to the current directory.

-XX:+PrintGC

-XX:+PrintGC

Enables printing of messages at every GC. By default, this option is disabled, but [[]] turns it on implicitly.





-verbose:gc
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=3M