Before Java9, we can just specify -Xloggc:/my/named/pipe to log garbage collection messages into a named pipe. However, when specifying -Xlog:gc*:file=/my/named/pipe
, JVM 9 complains about the named pipe:
[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.
How can we log GC messages to a named pipe in Java 9?
-Xlog:gc* Enables printing of detailed messages at every GC. -Xlog:gc:file=<filename> Logs messages with the gc tag to the file name specified. For example the option -Xlog:gc:file=gc.
You can enable verbose GC logs by specifying the -verbose:gc standard option when you start your application. For more information, see standard command-line options. The output of -verbose:gc is printed to STDERR by default. To print the log output to a file, append the -Xverbosegclog option.
Looking at the syntax specified under Unified JVM Logging, could you try replacing the arg from
-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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With