JDK-6950794 : Make the GC log file name parameterized
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs18
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2010-05-07
  • Updated: 2017-05-16
  • Resolved: 2014-09-15
Related Reports
Duplicate :  
Relates :  
Description
We have been asked by several developers if we could include some optional information to the GC log file name. The main requests were for 

- the pid of the JVM (say %p)
- a date stamp (say %t)

So, for example, if we log file name is specificed as 

foo.%p

it would be expanded to

foo.1234

if the pid of the JVM that created it is 1234.

See discussion on the openjdk lists for some of the proposals

http://mail.openjdk.java.net/pipermail/hotspot-gc-use/2010-May/000597.html

If we adopt 6950787: Make GC logs cyclic we could also make the sequence number of each log segment also a parameter (say: %n). In this case, the date stamp would correspond to the creation time of each log segment.

Comments
Can we close this as duplicate of JDK-7164841?
11-09-2014

EVALUATION Proposed solution is to enrich -Xloggc: value format with a number of embedded specifiers which are expanded with concrete values when GC log is created. It allows to easily distinguish logs from different JVM processes. The following 2-character specifiers are proposed: %p - Java process' PID %t - date stamp when log file is created (format: YYYY-MM-DD) %n - if log rotation logic is enabled, then log segment id, otherwise "0" %% - escaped '%' character in file name Multiple specifiers and muliple entries of the same specifier are allowed in the input string. Examples: 1) PID $ java -Xloggc:gc.%p.log ... & 1234 GC log: gc.1234.log 2) date time stamp $ date Thu Dec 22 18:07:17 MSK 2011 $ java -Xloggc:gc.%t.log ... GC log: gc.2011-12-22.log 3) log segment id when log rotation is enabled $ java -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=1M -Xloggc:gc.log.%n ... GC log files: gc.log.0, gc.log.2, gc.log.3, ..., gc.log.9 4) log segment id when log rotation is disabled $ java -XX:+UseGCLogFileRotation -Xloggc:gc.log.%n ... GC log: gc.log.0 5) complex example $ java -Xloggc:gc.%t.%p.log.%n GC log: gc.2011-12-22.1234.log.0
22-12-2011