Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8308947

Create new switch to print error reporting output to both hs_err_pid file and stdout/stderr

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Withdrawn
    • Icon: P4 P4
    • tbd
    • hotspot
    • None
    • behavioral
    • minimal
    • add/remove/modify command line option
    • JDK

      Summary

      Add two new switches to print error reporting both of hs-err log file and stdout or stderr.

      Problem

      ErrorFileToStdout and ErrorFileToStderr were introduced in JDK-8220786 to solve the problem of losing hs-err log files in a container environment. These are flags that are output to stdout or stderr "instead" of the hs-err log file, and if either is specified, no hs-err log file is created. Printing errors to stdout or stderr is useful for post-mortem analysis immediately after a problem occurs, and has the advantage of being applied outside of the container environment. However, enabling this flag does not generate an hs-err log file, which can cause old error logs to be deleted if running for a long time in an environment with many errors. In addition, the implementation of ErrorFileToStdout and ErrorFileToStderr is complex to add another option because it forces the output of the error log from the hs-err log file to stdout and stderr, and the error log output process should be streamlined to output both files and stdout. In particular, ErrorFileToStderr has a problem where the '#' section is printed twice to stdout and stderr, so we should consider using the expected destination.

      Solution

      Add two new switches "ErrorFileWithStdout" and "ErrorFileWithStderr" which print error reporting output to a hs_err file, further redirect it to stdout or stderr respectively. When ErrorFileToStderr is specified, error reports are printed only to stderr. Because printing the '#' section to both stdout and stderr is redundant and may lead to misunderstanding that it is another error.

      Specification

      Two switches, "ErrorFileWithStdout" and "ErrorFileWithStderr" are proposed. If "-XX:+ErrorFileWithStdout" ("-XX:+ErrorFileWithStderr") is specified on the command line, error logs are written to a hs-err file and stdout (stderr) when a fatal error occurs. After the logs are output to stdout (stderr), the location of the hs-err file is printed to stdout (stderr). The file location information with the proposed option is the same as with no options, except for the absence of the "with more information " message. Note that when the proposed option is specified, error summary information does not appear. Also note that when "-XX:+ErrorFileWithStderr" is specified, The file location information does not appear in stdout. When turning on more than one switch of "ErrorFileWithStdout", "ErrorFileWithStderr", "ErrorFileToStdout" and "ErrorFileToStderr", the last switch turned on overrides the prior switches.

      +  product(bool, ErrorFileWithStderr, false,                                 \
      +          "If true, error data is printed to stderr and a file")            \
      +                                                                            \
      +  product(bool, ErrorFileWithStdout, false,                                 \
      +          "If true, error data is printed to stdout and a file")            \
      +                                                                            \

      The specification of ErrorFileToStderr will be changed so that the '#' section is not printed to stdout.

            myano Masanori Yano
            myano Masanori Yano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: