[0.016s][info][os] Use of CLOCK_MONOTONIC is supported[0.016s][info][os] Use of pthread_condattr_setclock is not supported[0.016s][info][os] Relative timed-wait using pthread_cond_timedwait is associated with the default clock[0.017s][info][os] SafePointPolling address,bad (protected) page:0x0000000108901000,good (unprotected) page:0x0000000108902000[0.022s][info][biasedlocking] Aligned thread 0x00007f983e008200 to 0x00007f983e008800[0.023s][info][os,thread ] Threadattached (tid:10499, pthread id:123145571979264).
-Xlog Usage:-Xlog[:[selections][:[output][:[decorators][:output-options]]]] where 'selections' are combinations of tags and levels of the form tag1[+tag2...][*][=level][,...] NOTE:Unlesswildcard (*) is specified, only log messages tagged with exactly the tags specified will be matched.
Available log levels: off, trace, debug, info, warning, error
下面举个例子:
java -Xlog:os,class=info -version
输出结果:
[0.002s][info][os] Use of CLOCK_MONOTONIC is supported[0.002s][info][os] Use of pthread_condattr_setclock is not supported[0.002s][info][os] Relative timed-wait using pthread_cond_timedwait is associated with the default clock[0.003s][info][os] SafePointPolling address,bad (protected) page:0x0000000109543000,good (unprotected) page:0x0000000109544000[0.006s][info][os] attempting shared library load of /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/lib/libjava.dylib[0.007s][info][os] shared library load of /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/lib/libjava.dylib was successful[0.007s][info][os] attempting shared library load of /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/lib/libzip.dylib[0.010s][info][os] shared library load of /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/lib/libzip.dylib was successful
output
output表示将日志输出到什么地方。
output的可选项:
stdout/stderr file=<filename>
stdout表示标准输出,stderr表示标准错误。file表示输出到文件里面。
举个例子:
java -Xlog:all=debug:file=debug.log-version
decorators
decorators表示输出哪些内容到日志中。
time (t),utctime (utc),uptime (u),timemillis (tm),uptimemillis (um),timenanos (tn),uptimenanos (un),hostname (hn),pid (p),tid (ti),level (l),tags (tg)Decorators can also be specified as 'none'for no decoration