简体   繁体   English

如何在Java 9中将GC日志写入命名管道?

[英]How to write GC log to named pipe in Java 9?

Before Java9, we can just specify -Xloggc:/my/named/pipe to log garbage collection messages into a named pipe . 在Java9之前,我们可以指定-Xloggc:/ my / named / pipe将垃圾收集消息记录到命名管道中 However, when specifying -Xlog:gc*:file=/my/named/pipe , JVM 9 complains about the named pipe: 但是,当指定-Xlog:gc*:file=/my/named/pipe ,JVM 9会抱怨命名管道:

[0.003s][error][logging] Unable to log to file /my/named/pipe,  /my/named/pipe is not a regular file.

We are using Linux RedHat with jdk_9.0.1_x64. 我们正在使用Linux RedHat和jdk_9.0.1_x64。

How can we log GC messages to a named pipe in Java 9? 我们如何在Java 9中将GC消息记录到命名管道?

Looking at the syntax specified under Unified JVM Logging , could you try replacing the arg from 查看Unified JVM Logging下指定的语法,您可以尝试替换arg

-xlog:gc*.file=/my/named/pip

to

-Xlog:gc*=info:file=gctrace.txt
           ^  ^          ^
       level  colon   filename

or simply 或者干脆

-Xlog:gc*:file=gctrace.txt // since default level for gc logging is INFO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM