简体   繁体   中英

JVM gc log not rotating

I'm using solaris 10, Wildfly 10 and java 1.8.0_66.

I thought to make gc log rotating, as long as I set the following parameters:

-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles
-XX:GCLogFileSize
-Xloggc

it should rotate.

I set jvm params to be

JAVA_OPTS="$JAVA_OPTS -XX:-HeapDumpOnOutOfMemoryError  -verbosegc -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=50 -XX:GCLogFileSize=5K -XX:+PrintGCDateStamps -Xloggc:/mylocation/standalone/log/gc.log"

It does not rotate. It seems that I have to add param -XX:+PrintGCDetails to make gc log file rotate.

Did my understanding wrong? or did I miss any settings so it doesn't rotate?

Thanks, Helen

It seems you've already figured that out yourself. GCLogFileSize has the minimum value of 8KB in JDK, even if you try to set less. Here is the relevant fragment from HotSpot sources :

  if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) {
    FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K);
    jio_fprintf(defaultStream::output_stream(),
                "GCLogFileSize changed to minimum 8K\n");
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM