1

I want to config Garbage Collector log rotation:

-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=2 -XX:GCLogFileSize=512.

will it work for java 6 version 22? I need to know when this fix included in java 6 (from which version) and if it will work in my version (java 6 update 22).

No Idea For Name
  • 11,411
  • 10
  • 42
  • 70
Sarit
  • 101
  • 1
  • 3
  • 6

1 Answers1

1

Based on this Blog post : Rolling Java GC Logs, the GC logs can be automatically rotated as of Oracle Java 1.6_34 (or 1.7_2 in the latest minor version).

It looks like you are out of luck for Java 6_u22. You will probably need to rotate your GC logs by yourself using a cron job.

In order to implement manual rotation of GC logs, see Garbage collector log (loggc) file rotation with logrotate does not work properly.

Community
  • 1
  • 1
Aleš
  • 8,896
  • 8
  • 62
  • 107
  • can you explain how can I rotate the GC log manually? I do not restart the program every day, so I can`t give a different path to the GC log in each start/shutdown of the server. How can I save all the GC log data so it will not erase the information above it`s limited size? – Sarit Jul 22 '13 at 07:44
  • You can either just update your JVM to run with the automatic GC rotation, or look at this Q/A about manual file rotation : http://stackoverflow.com/q/8353401/772000 – Aleš Jul 22 '13 at 22:07
  • I need the time stamp (not relative). can I do something like this: java -XX:+PrintGCDetails -XX:+PrintGCDateStamps -verbose:gc >> gc.log? or java -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:logs/gc.log >> gc.log instead of verbose:gc? – Sarit Jul 23 '13 at 14:08
  • you can use both, all the GC logs from teh verbose:gc will go to the logs/gc.log file – Aleš Jul 23 '13 at 23:03