Java Garbage Collection Logging: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=


* [[Java Garbage Collection#Garbage_Collection_Logging|Java Garbage Collection]]
* [[Java Memory#Garbage_Collection_Logging|Java Memory]]


=Command Line Options=
=Java 9=


==Java 8==
"-Xloggc:" becomes "-Xlog:gc:"


{{External|https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BABFAFAE}}
'PrintGCDateStamps' was dropped.


===Overview===
=Java 8=


In Java 8, GC logging is enabled with the <tt>[[#-Xloggc:|-Xloggc:<file>]]</tt> (see below). The actual -XX values the JVM operates with are displayed at the top of the log file:
{{Internal|Java 8 Garbage Collection Logging#Overview|Java 8 Garbage Collection Logging}}


<pre>
=Application Specific GC Logging=
...
CommandLine flags: -XX:InitialHeapSize=268435456 -XX:MaxHeapSize=4294967296 -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC
...
</pre>


===Options===
==WildFly GC Logging==


====-Xloggc:====
{{Internal|WildFly_JVM_Settings#Standalone_Mode_GC_Logging|WildFly GC Logging in Standalone Mode}}
 
{{Internal|WildFly_JVM_Settings#Domain_Mode_GC_Logging|WildFly GC Logging in Domain Mode}}
<pre>
-Xloggc:<file>
</pre>
 
where <file> can be absolute or relative. In case of a relative path, it is relative to the current directory.
 
====-XX:+PrintGC====
 
<pre>
-XX:+PrintGC
</pre>
 
Enables printing of messages at every GC. By default, this option is disabled, but <tt>[[#-Xloggc:|-Xloggc:<file>]]</tt> turns it on implicitly.
 
====-XX:+PrintGCTimeStamps====
 
<pre>
-XX:+PrintGCTimeStamps
</pre>
 
Enables printing of time stamps (time in seconds since the JVM started) at every GC. By default, this option is disabled. It is implicit turned on if <tt>[[#-Xloggc:|-Xloggc:<file>]]</tt> is used. Time stamps recorded this way provide a chronology relative to the time the JVM started, but additional calculation is needed to translate the timestamps to normal timestamps, and it is only possible if the JVM start time is also recorded. A better way to record timestamps is to use [[]].
 
When used, the timestamps are recorded in the following format:
 
<pre>
2017-02-12T19:26:03.328+0800:
</pre>
 
====-XX:+PrintGCDateStamps=====
 
<pre>
-XX:+PrintGCDateStamps
</pre>
 
 
 
 
 
 
 
<pre>
-verbose:gc
</pre>
 
<pre>
-XX:+PrintGCDetails
</pre>
 
<pre>
-XX:+PrintGCDateStamps
</pre>
 
<pre>
-XX:+UseGCLogFileRotation
</pre>
 
<pre>
-XX:NumberOfGCLogFiles=5
</pre>
 
<pre>
-XX:GCLogFileSize=3M
</pre>

Latest revision as of 19:22, 28 December 2020

Internal

Java 9

"-Xloggc:" becomes "-Xlog:gc:"

'PrintGCDateStamps' was dropped.

Java 8

Java 8 Garbage Collection Logging

Application Specific GC Logging

WildFly GC Logging

WildFly GC Logging in Standalone Mode
WildFly GC Logging in Domain Mode