lea*_*ner 4 java garbage-collection java-9
我的应用程序正在使用gc标志“ PrintGCApplicationStoppedTime”,但是当与Java 9一起运行时,它失败并显示以下错误:
Unrecognized VM option 'PrintGCApplicationStoppedTime'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Run Code Online (Sandbox Code Playgroud)
该帖子表明该选项已被弃用,但他的旗帜打印的信息是否还有其他选择,或者该信息不再可用?
几件事要知道:
首先,以及答案在这里通过@apangin总结了相当不错的PrintGCApplicationStoppedTime打印中所花费的时间safepoints。
为了将更多细节转储到应用程序的安全点上,您最好使用:
-XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1
Run Code Online (Sandbox Code Playgroud)
其次,Java 9计划在JEP#271下实现Unified GC日志记录,同时将利用JEP#158下的Unified JVM Logging。
展望未来,-Xlog它将用作新的命令行选项来控制来自JVM所有组件的日志记录。因此,日志记录将遵循以下语法(引用):
-Xlog[:option]
option := [<what>][:[<output>][:[<decorators>][:<output-options>]]]
'help'
'disable'
what := <selector>[,...]
selector := <tag-set>[*][=<level>]
tag-set := <tag>[+...]
'all'
tag := name of tag
level := trace
debug
info
warning
error
output := 'stderr'
'stdout'
[file=]<filename>
decorators := <decorator>[,...]
'none'
decorator := time
uptime
timemillis
uptimemillis
timenanos
uptimenanos
pid
tid
level
tags
output-options := <output_option>[,...]
output-option := filecount=<file count>
filesize=<file size in kb>
parameter=value
Run Code Online (Sandbox Code Playgroud)
可以从中学习到一些不同的示例的地方是:
-Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1024
Run Code Online (Sandbox Code Playgroud)
-Xlog:gc+rt+compiler*=debug,meta*=warning,svc*=off
Run Code Online (Sandbox Code Playgroud)