RFR: 8301627: System.exit and Runtime.exit debug logging [v5]

Alan Bateman alanb at openjdk.org
Fri Feb 17 07:52:19 UTC 2023


On Thu, 16 Feb 2023 21:53:00 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> It can be difficult to find the cause of calls to `java.lang.System.exit(status)` and `Runtime.exit(status)` because the Java runtime exits.
>> The status value and stack trace are logged using the System Logger named `java.lang.Runtime` with message level `System.Logger.Level.DEBUG`.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Improve implNote for Runtime.exit() with review suggestions.

I see the test is added to test/jdk/java/lang/runtime but that is the tests for java.lang.runtime. The tests for java.lang.Runtime were moved to  test/jdk/java/lang/RuntimeTests at some point. So I think the new test should move there.

src/java.base/share/classes/java/lang/Runtime.java line 162:

> 160:      * If the {@link System#getLogger(String) the system logger} for {@code java.lang.Runtime}
> 161:      * is enabled with logging level {@link System.Logger.Level#DEBUG Level.DEBUG} the stack trace
> 162:      * of the call to {@code Runtime.exit()} is logged.

Have you ruled out adding the implNote to System.exit too? Asking as I suspect it's more likely to be read there.

src/java.base/share/classes/java/lang/Shutdown.java line 178:

> 176:     // Locate and return the logger for Shutdown.exit, if it is functional and DEBUG enabled.
> 177:     // Exceptions should not prevent System.exit; the exception is printed and otherwise ignored.
> 178:     private static System.Logger getRuntimeExitLogger() {

The method descriptions in this this class use /* .. */ style so probably best to keep it consistent if you.

-------------

PR: https://git.openjdk.org/jdk/pull/12517


More information about the core-libs-dev mailing list