[11u] RFR: 8238531: Create new switch to redirect error reporting output to stdout or stderr
Thomas Stüfe
thomas.stuefe at gmail.com
Wed Feb 5 15:29:54 UTC 2020
Hi all,
would like to backport this enhancement since it comes in very handy in
cloud environments without any file systems.
original issue: https://bugs.openjdk.java.net/browse/JDK-8220786
original patch: http://hg.openjdk.java.net/jdk/jdk/rev/cf75ea6af695
Please note that the issue is accompanied by a CSR [1] for which I have
created a backport CSR [2] according to the rules laid out in [3]. CSR will
be approved separately I think.
----
The patch does not apply cleanly since 8209856 [4] removed some coding
which is still present in jdk11. This is limited to one hunk in
vmError.cpp, which I modified:
--- a/src/hotspot/share/utilities/vmError.cpp Mon Mar 25 09:35:40 2019
+0100
+++ b/src/hotspot/share/utilities/vmError.cpp Wed Feb 05 15:41:51 2020
+0100
@@ -1458,24 +1458,31 @@
_current_step_info = "";
}
+ // Part 2: print a full error log file (optionally to stdout or stderr).
// print to error log file
if (!log_done) {
// see if log file is already open
if (!log.is_open()) {
// open log file
- fd_log = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer,
sizeof(buffer));
- if (fd_log != -1) {
- out.print_raw("# An error report file with more information is
saved as:\n# ");
- out.print_raw_cr(buffer);
+ if (ErrorFileToStdout) {
+ fd_log = 1;
+ } else if (ErrorFileToStderr) {
+ fd_log = 2;
+ } else {
+ fd_log = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer,
sizeof(buffer));
+ if (fd_log != -1) {
+ out.print_raw("# An error report file with more information is
saved as:\n# ");
+ out.print_raw_cr(buffer);
- log.set_fd(fd_log);
- } else {
- out.print_raw_cr("# Can not save log file, dump to screen..");
- log.set_fd(fd_out);
- /* Error reporting currently needs dumpfile.
- * Maybe implement direct streaming in the future.*/
- transmit_report_done = true;
+ } else {
+ out.print_raw_cr("# Can not save log file, dump to screen..");
+ fd_log = 1;
+ /* Error reporting currently needs dumpfile.
+ * Maybe implement direct streaming in the future.*/
+ transmit_report_done = true;
+ }
}
+ log.set_fd(fd_log);
}
----
Tests: manually and SAP nightlies, no issues.
Thank you,
Thomas
----
[1] https://bugs.openjdk.java.net/browse/JDK-8220787
[2] https://bugs.openjdk.java.net/browse/JDK-8238532
[3] https://wiki.openjdk.java.net/display/JDKUpdates/How+to+contribute+a+fix
[4] https://bugs.openjdk.java.net/browse/JDK-8209856
More information about the jdk-updates-dev
mailing list