< prev index next >
src/hotspot/share/utilities/vmError.cpp
Print this page
rev 54260 : 8220786: Create new switch to redirect error reporting output to stdout or stderr
Reviewed-by:
@@ -1443,35 +1443,45 @@
st->cr();
}
}
}
- // print to screen
+ // Part 1: print an abbreviated version (the '#' section) to stdout.
if (!out_done) {
+ // Suppress this output if we plan to print Part 2 to stdout too.
+ // No need to have the "#" section twice.
+ if (!(ErrorFileToStdout && out.fd() == 1)) {
report(&out, false);
+ }
out_done = true;
_current_step = 0;
_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
+ 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);
+ fd_log = 1;
+ }
}
+ log.set_fd(fd_log);
}
report(&log, true);
log_done = true;
_current_step = 0;
< prev index next >