This discussion is archived
2 Replies Latest reply: Apr 18, 2013 1:36 AM by 1003814 RSS

GC Log Rotation on application restart

1003814 Newbie
Currently Being Moderated
Hi,

I have a Java process that is getting restarted quite often. I would like to examine the GC Logs both before and after the restart to understand what is happening. But the verbose GC Logs get over written on a restart.

Is there any JVM setting to rotate GC logs on restart of an application ?

Regards
Vidhuran
  • 1. Re: GC Log Rotation on application restart
    gimbal2 Guru
    Currently Being Moderated
    Google: "java gc log settings"

    Result: http://stackoverflow.com/questions/3822097/rolling-garbage-collector-logs-in-java

    It is -so- easy to find answers to "how to do this" questions: join the group of people who use google and rejoice.
  • 2. Re: GC Log Rotation on application restart
    1003814 Newbie
    Currently Being Moderated
    Hi,

    I had already googled earlier to find answers on how to do this.

    But the gc log file that is written after a restart is always the file with a suffix 0 and it gets overwritten every time the process restarts.

    i have the following JVM parameters in place
    -verbose:gc
    -XX:+PrintGCDetails
    -XX:+PrintGCTimeStamps
    -XX:+PrintGCDateStamps
    -XX:+UseGCLogFileRotation
    -XX:NumberOfGCLogFiles=5
    -XX:GCLogFileSize=10M
    -Xloggc:/opt/data/mz_app/log/ec2_gc.log 
    However the log file written is always ec2_gc.log.0

    Regards
    Vidhuran

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points