JDK-7164841 : Improvements to the GC log file rotation
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: sparc
  • Submitted: 2012-04-27
  • Updated: 2014-12-03
  • Resolved: 2013-09-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u76Fixed 8Fixed hs25Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
Alcatel suggested the following improvents in the GC log file rotation handling:

Improvement
1. Can you add a log message that includes a date/time stamp when a file is rotated to the new file being created.   This helps in debugging/etc. GC problems and so can quickly determine which is the "active" GC log file.
Would not hurt to add log the the end of the previous file as well...

e.g For end...
2012.04.21 09:17:28 -0400  GC log file has reached the maximum size. Saved as GC_trace_042312-11:23:20.log.2

eg For start..
2012.04.21 09:17:28 -0500  GC log file created GC_trace_042312-11:23:20.log.2

2. Error log message improvement, if get incorrect parameters get the
following output:
...
To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogRotaion -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>
where num_of_file > 0 and num_of_size > 0
GC log rotation is turned off

Notice:
a. "UseGCLogRotaion" is not spelled correctly
b. "-XX:GCLogFileSize" should provide units (K or M ...?)...Believe K
and M are supported?

Would be nice to get the above corrected...

Comments
New solution is, we parameterize the input file name for -Xloggc:<filename>, filename is restricted for characters '[A-Z][a-z][0-9][.][-][_]', it only restricts filename not path. That is, if user gives temp/mydir/test$$.log, it will be rejected only for it contains '$' in the file name. If it is temp/mydir/test/log, it will be OK. %p in file name will be replaced by pid<1234>, %t in file name will be replaced by time string: YYYY-MM-DD_HH-MM-SS. To easily identify currently used log file, the file name will be filename.<i>.current, which is the current rotating file number. After the current file log reaches maximum, save this file as filename.<i>. Another changes is adding header information of vm version, os version, memory usage and comandline flags.
13-09-2013

Current code shows that the prompt already corrected: jio_fprintf(defaultStream::output_stream(), "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>\n" "where num_of_file > 0 and num_of_size > 0\n" "GC log rotation is turned off\n"); UseGCLogFileRotation = false; The num_of_size is a number of bytes. It can be <num>K or <num>M, vm will convert it to bytes.
13-08-2013

Updating hs30 -> hs25 to reflect version number of HotSpot going into JDK8.
26-10-2012