In Java 11 a number of JVM args relating to GC logging are not supported anymore. What, if anything, can they be replaced with, if we still want to use GC logging? In particular, this relates to the following JVM args:
-Xlog:gc:work/logs/gc.log
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
-XX:+PrintGCApplicationStoppedTime
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles
-XX:GCLogFileSize
Thanks.
List of your <arguments, current mapping, reasons>
is as follows:
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps ==> Not applicable now.
Reason: Time/date stamps are logged by the framework.
-XX:+PrintGCDetails ==> -Xlog:gc*
-XX:+PrintGCApplicationStoppedTime ==> -Xlog:safepoint
Note: PrintGCApplicationConcurrentTime
and PrintGCApplicationStoppedTime
are logged on the same tag and not separated in the new logging.
-XX:+UseGCLogFileRotation ==> Not Applicable
Note: Same as what was logged for PrintTenuringDistribution
.
-XX:NumberOfGCLogFiles
-XX:GCLogFileSize ==> Not Applicable
Reason: Log rotation is handled by the framework.
Reference:- The documentation I've referred to and request you to follow for such migration details.
BTW, although the NumberOfGCLogFiles
and GCLogFileSize
options are gone in Java 11, it is still possible to set rolling file size and count. For example:
java -Xlog:gc*,safepoint:gc.log:time,uptime:filecount=100,filesize=128K ...
It does print date with time
-Xlog:gc*:verbose_gc.log:time
[2019-05-13T14:01:03.356+0530] Heap region size: 1M
[2019-05-13T14:01:03.357+0530] Using G1
NOTE :- JDK 11 been used
来源:https://stackoverflow.com/questions/54144713/is-there-a-replacement-for-the-garbage-collection-jvm-args-in-java-11