2 Replies Latest reply: Apr 18, 2013 3:36 AM by 1003814 RSS

    GC Log Rotation on application restart

    1003814
      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
          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
            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