Rolling garbage collector logs in java

前端 未结 6 930
孤街浪徒
孤街浪徒 2020-12-08 04:12

Is it possible to do a rolling of garbage collector logs in Sun JVM?

Currently I generate logs using:

-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:         


        
6条回答
  •  -上瘾入骨i
    2020-12-08 04:45

    Have you tried this new options?

    I tried jdk7u7, jdk7u6 and jdk6u35 like this:

    java -Xloggc:gc.log -XX:+PrintGCDetails -XX:+UseGCLogRotation -XX:NumberOfGClogFiles=3 -XX:GCLogFileSize=10M
    

    but with every version I'm seeing this error:

    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    

    Bugfix #6941923 for 7u2 is referenced here: http://www.oracle.com/technetwork/java/javase/2col/7u2bugfixes-1394661.html

提交回复
热议问题