On Tue, 14 Feb 2023 18:56:29 GMT, Roger Riggs <rri...@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:
> 
>   Correct System.getLogger link

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

> 166:                 Throwable throwable = new Throwable("Runtime.exit(" + 
> status + ")");
> 167:                 log.log(System.Logger.Level.DEBUG, "Runtime.exit() 
> called with status: " + status,
> 168:                         throwable);

I'd put a try/catch around the actual logging of the message, to avoid a 
situation where an error in the logger handler prevents the system from being 
shut down.

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

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

Reply via email to