When sent a SIGQUIT, HotSpot prints a thread dump on stdout. In response to the same signal, OpenJ9 writes a javacore dump to a file, and prints the filename and dump event details on stderr.
Writing the data to a file is a better approach in most scenarios, but under certain circumstances it would be preferable to write the output to stdout/stderr instead, so it would be useful to have to the option to do that.
For more background:
What's the best way for the JVM to communicate logs to things like kubectl logs? Especially given that many ELK stacks are configured to monitor stdout/stderr.
Hello, will be looking into this Issue.
Any suggestions of what the name of this new option will be? I was thinking “-Xdump:printToStdOut”
@AidanHa Check out the existing -Xdump options. There may be a better way to fit this into the current filename options.
I think -Xdump:java:file=STDOUT/ERR is probably the best option. I will be adding support to this option
@keithc-ca
@AidanHa This looks like it needs a change to the user documentation to capture the new suboption. Please add a doc:externals label to this issue for tracking purposes and open an issue at the docs repo for getting the doc updated: https://github.com/eclipse/openj9-docs/issues/new?template=new-documentation-change.md
We should ensure that uppercase or lowercase is accepted.
I was going to suggest this capability is already available (at least on Linux), but the VM refuses to overwrite an existing file:
$ java -Xdump:java:events=vmstart,file=/dev/tty -version
JVMDUMP039I Processing dump event "vmstart", detail "" at 2019/01/30 09:30:04 - please wait.
JVMDUMP030W Cannot write dump to file /dev/tty: File exists
Another option is to use 1 and 2 as special cases for stdout and stderr as commandline users are used to piping output to / from those special file descriptors.
A common convention is that '-' means stdin/stdout depending on whether it will be read or written. I'm not aware of a convention for stderr.
The code actually checks for '-' explicitly.
The code actually checks for
'-'explicitly.
Instead of considering that illegal, we could interpret it as stdout. Do we _need_ stderr as well?
Do we need stderr as well?
The request for this comes from kubectl users who wanted to use the default logging drivers that intercept stdout / stderr. From some quick googling I can't tell whether kube can differentiate between them - there's a github issue for it but it seems to have gone stale.
Considering we typically output JVM diagnostics to stderr it makes sense to support both, though we can merge support for stdout first.
Reopening: https://github.com/eclipse/openj9/pull/4521/files#r254310704 will need to be addressed.