在那里很少有人知道:
首先,@ apangin的答案here很好地总结了 PrintGCApplicationStoppedTime 打印了在safepoints内花费的时间 .
为了将更多细节转储到您的应用程序的安全点,您应该更好地利用:
-XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1
继续使用哪个 -Xlog 将用作新的命令行选项来控制来自JVM的所有组件的日志记录 . 因此,日志记录将遵循语法(引用):
-Xlog[:option]
option := [][:[][:[][:]]]
‘help’
‘disable’
what := [,…]
selector := [*][=]
tag-set := [+…]
‘all’
tag := name of tag
level := trace
debug
info
warning
error
output := ‘stderr’
‘stdout’
[file=]
decorators := [,…]
‘none’
decorator := time
uptime
timemillis
uptimemillis
timenanos
uptimenanos
pid
tid
level
tags
output-options := [,…]
output-option := filecount=
filesize=
parameter=value
选择几个不同的例子来学习:
-Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1024
使用’trace’标记’gc’标记的日志消息到一个旋转文件集,其中包含5个文件,大小为1MB,基本名称为’gctrace.txt’,并使用decorations ‘uptimemillis’和’pid’
级别’warning’到’stderr’的所有消息的默认输出仍然有效
-Xlog:gc+rt+compiler*=debug,meta*=warning,svc*=off
日志消息至少用’gc’和’rt’以及’compiler’标记使用’trace’级别标记为’stdout’,但仅记录标记为’meta’且级别为’warning’或’error’的消息,并关闭所有标记为’svc’的消息
级别’warning’到’stderr’的所有消息的默认输出仍然有效