RFR: 7164841: Improvements to the GC log file rotation

Yumin Qi yumin.qi at oracle.com
Mon Aug 19 17:48:16 UTC 2013


Scott and Yasumasa,

   Thanks for your information for bug 6950794.

   According to my current implementation, it is easy to identify which 
file is the current log ---- it ends up with .current appendix. At app 
exit, it did not renamed to other name so still is the last and latest 
log file.

   I will make modification based on current implementation to cover 
suggestions mentioned  in bug 6950794.
   This will be only targeted to if gc log file rotations successfully set:
   Log file name will be <filename>-pid%p-YYYY-MM-DD_HH-MM-SS.%i  which 
p is pid and i be one of 0, ...., n-1. I am not planning to parse 
command line to get those info since they are available internally. Hope 
this will solve the problems mentioned in bug 6950794.

   So the rotation will be:
    1) File name,  like mentioned above, example: 
gc.log-pid1234-2013-08-19_08-20-00.1 with
          -Xloggc:gc.log -XX:+UseGCLogFileRotation 
-XX:NumberOfGCLogFiles=5  -XX:GCLogFileSize=1M
         Time stamp is the start of first rotation file created, and all 
rotation files share the same time stamp in file name.
    2) Time stamp of each rotation begings still logged when it is 
started, finished.
    3) For rotation in same file, the file name will be 
<filename>-pid%p-YYYY-MM-DD_HH-MM-SS

   Let me know what you think.

Thanks
Yumin

On 8/19/2013 8:07 AM, STIRLING, SCOTT wrote:
> For hosting large e-comm sites with dozens to hundreds of JVMs, where we always have GC logging enabled, the advent of GC log rotation features in the JVM was a nice surprise and I started using it immediately on a major new e-comm site (with Oracle ATG and Weblogic on Sun 1.6-latest JDK and RHEL). But as the file naming and rotation work now, when you stop and then restart a JVM with GC log rotation enabled, it overwrites the last un-rotated log file. That's not usually what we want. We like logs to have the timestamp or datestamp encoded in the file name for scripting, for future reference when logs are on a laptop for analysis with visualization tools (more important these days as GC logs for new garbage collectors get uglier and uglier), etc.
>
> It's possible to parameterize the log file name in scripts before it is passed to the JVM, but that's been do-able for years. And if you take a product such as Oracle Weblogic, it has a versionable, auto-deployed, centrally manageable config.xml, which we like to use as much as possible for, e.g., all the JVM args for all the JVMs in the domain. There's no facility for parameterized variables in config.xml. So you have to, again, do stuff in the launch script, which is more stuff to maintain, and so on.
>
> I'm willing to compile the patch for 6950794 and let you know if it compiles on Windows 7, 64 bit. I'm just a list observer but I can build it.
>
> Scott Stirling
> AT&T, Boston
>
> -----Original Message-----
> From: hotspot-gc-dev-bounces at openjdk.java.net [mailto:hotspot-gc-dev-bounces at openjdk.java.net] On Behalf Of Yasumasa Suenaga
> Sent: Sunday, August 18, 2013 8:34 PM
> To: Yumin Qi
> Cc: hotspot-gc-dev at openjdk.java.net; hotspot-runtime-dev at openjdk.java.net
> Subject: Re: RFR: 7164841: Improvements to the GC log file rotation
>
> Hi Yumin,
>
> I've posted a RFE and patch for adding timestamp, PID, etc to log filename.
>
> JDK-6950794 : Make the GC log file name parameterized
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6950794
> http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2012-July/004758.html
>
> Your patch writes timestamp into logfile.
> Howeverm, in production system, we may want to check log generation through
> log filename. (e.g. ls command at Linux)
>
> Could you check my patch?
>
>
> Thanks,
>
> Yasumasa
>
> On 2013/08/16 0:35, Yumin Qi wrote:
>> Hi,
>>
>>     Can I have your review for this small changes?
>> http://cr.openjdk.java.net/~minqi/7164841/webrev00/ <http://cr.openjdk.java.net/%7Eminqi/7164841/webrev00/>
>>
>>      This is for a enhancement to add head/tail message to the logging files to assist reading GC output.
>>      1. modified prompt message if invalid arguments used for log rotating;
>>      2. add time and file name message to log file head/tail.
>>      3. for easily identify which log file is current, use file name like <filename>.n.current, after it reaches maximum size, rename it to <filename>.n
>>           On Windows, there is no F_OK (existing test) definition, F_OK is defined as "0" and for _access of VC++, it just describes:
>>
>> modevalue
>>
>> 	
>>
>> Checks file for
>>
>> 00
>>
>> 	
>>
>> Existence only
>>
>> 02
>>
>> 	
>>
>> Write-only
>>
>> 04
>>
>> 	
>>
>> Read-only
>>
>> 06
>>
>> 	
>>
>> Read and write
>>
>>
>> http://msdn.microsoft.com/en-us/library/1w06ktdy.aspx
>> The definition are consistent with unistd.h.
>>
>>       Test: JPRT and jtreg.
>>
>>      Thanks
>>      Yumin




More information about the hotspot-gc-dev mailing list