"-XX:+PrintGCDateStamps" - Calendar Timestamp on GC Messages

This section describes the garbage collection logging option, '-XX:+PrintGCDateStamps', which adds a calendar timestamp to each GC log message.

Now, let's try the "-XX:+PrintGCDateStamps" garbage collection logging option to see what we will get in the log file:

C:\>\progra~1\java\jdk1.8.0\bin\java -Xms2m -Xmx64m -XX:+PrintGCDetails 
   -XX:+PrintGCDateStamps -Xloggc:gc.log  GarbageCollection
1   2031616   698848   1332768
2   3874816   1473392   2401424
3   3874816   425688   3449128
4   8970240   4442016   4528224

C:\>type gc.log
CommandLine flags: -XX:InitialHeapSize=2097152 -XX:MaxHeapSize=67108864
   -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails 
   -XX:+PrintGCTimeStamps -XX:-UseLargePagesIndividualAllocation 
2018-04-01T21:00:47.418-0100: 0.719: [GC (Allocation Failure) 
   0.725: [DefNew: 889K->64K(960K), 0.0074037 secs] 
   889K->755K(1984K), 0.0131249 secs] 
2018-04-01T21:00:48.448-0100: 1.748: [GC (Allocation Failure) 
   1.748: [DefNew: 865K->64K(960K), 0.0059537 secs]
   1.754: [Tenured: 1476K->1540K(1540K), 0.0502278 secs] 
2018-04-01T21:00:49.512-0100: 2.813: [GC (Allocation Failure) 
   2.813: [DefNew: 1061K->127K(1216K), 0.0049146 secs] 
   2601K->2580K(3784K), 0.0050707 secs] 
2018-04-01T21:00:50.527-0100: 3.827: [GC (Allocation Failure) 
   3.827: [DefNew: 1171K->127K(1216K), 0.0047282 secs]
   3.832: [Tenured: 3492K->3604K(3604K), 0.0049167 secs] 
 def new generation   total 19648K, used 6651K [...
  eden space 17472K,  38% used [...
  from space 2176K,   0% used [...
  to   space 2176K,   0% used [...
 tenured generation   total 43712K, used 32990K [...
   the space 43712K,  75% used [...
 Metaspace used 1561K, capacity 2242K, committed 2368K, reserved 4480K

Notes on the output:

Obviously, extra calendar timestamp generated from the "-XX:+PrintGCDateStamps" option does help if you want to troubleshoot any memory issues. So you should use "-XX:+PrintGCPrintGCDetails" all the time.

Last update: 2018.

Table of Contents

 About This Book

 Heap Memory Area and Size Control

JVM Garbage Collection Logging

 Garbage Collection Demo Program

 Garbage Collection Logging Options

 "-XX:+PrintGC" - GC Logging Option for Short Messages

 "-XX:+PrintGCDetails" - Option for Detailed GC Messages

"-XX:+PrintGCDateStamps" - Calendar Timestamp on GC Messages

 "-XX:+PrintGCApplicationStoppedTime" - Application Pause Durations

 "-XX:+PrintGCApplicationConcurrentTime" - Application Running Durations

 "-XX:+PrintHeapAtGC" - Print Heap Summary per GC

 "-XX:+PrintTenuringDistribution" - Tunuring Distribution

 "-XX:+PrintReferenceGC" - Reference Counts per GC

 "-XX:+PrintFlagsFinal" - Print JVM Options

 Introduction of Garbage Collectors

 Serial Collector - "+XX:+UseSerialGC"

 Parallel Collector - "+XX:+UseParallelGC"

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 Garbage First (G1) Collector - "+XX:+UseG1GC"

 Object References and Garbage Collection

 Garbage Collection Performance Test Program

 Performance Tests on Serial Collector

 Performance Tests on Parallel collector

 Performance Tests on Concurrent collector

 Performance Tests on G1 collector

 Garbage Collection Performance Test Summary

 Outdated Tutorials


 Full Version in PDF/EPUB