Reputation: 171
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
Upvotes: 2
Views: 2631
Reputation: 98570
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");
}
Upvotes: 3