Is there a replacement for the garbage collection JVM args in Java 11?

柔情痞子 提交于 2019-11-30 07:10:48

问题


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.


回答1:


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.




回答2:


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



回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!