GC log rotation question



So after JDK 1.6.0_34 (as far as I know), java introduced GC log rotation JVM args (see below)


-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=1M


    Prior to these JVM arg additions, on any java application start, your GC log would get wiped. In my case a tomcat server running java code.


    So now I would assume when these JVM arg's are present, the GC log continues to rotate and not get wiped on application start up. However the above behavior still persists ever after JDK 1.6.0_34 with the new JVM args present.


    I should mention while the java application is running, the GC log DOES rotate (i.e., gc_log.txt.0, becomes gc_log.txt.1), but when application is restarted the LAST GC log is erased completely.

This behavior isn't really "log rotation/backup", I've had to introduce my own shell/bat scripts to rotate the latest GC logs manually outside of these JVMargs. I'm not sure if I'm misunderstanding how to use the new JVM args or if oracle doesn't consider this a bug and this is normal behavior.


I did file a bug on this, 9005051. However there is no guarantee your bug request ever makes it to the public bug database and oracle doesn't provide reasoning back to the submitter when the bug is rejected or not looked at, so I don't really know what happened with my bug request.


If anyone has any insight into this, I would really appreciate it.


Thank you!
Who is Participating?
wfsoftwareConnect With a Mentor Author Commented:
Oracle has no interest in my question, https://forums.oracle.com/thread/2569716

So I've given up trying to solve it, I could go look at src, and solve it. But I'd rather not create a custom jdk implementation just to fix a bug (well I think its a bug) that is about GC logs being overwritten.

I'll close this one, thanks for the responses!
My guess is that your assumption about wiping being normal behaviour is correct
wfsoftwareAuthor Commented:
Just making my solution the solution, since oracle won't fix it or even consider reviewing it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.