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

Roger Riggs rriggs at openjdk.org
Thu Feb 16 21:05:30 UTC 2023


On Tue, 14 Feb 2023 19:02:52 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> 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.

If there is an error in the logging, it should not be hidden so it can be fixed by the developer or logging configuration.
A mis-configured or malfunctioning logging system might hide more than just this particular case.

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

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


More information about the core-libs-dev mailing list