Logging JVM exit (in context of JEP 486)
Michael Bien
mbien42 at gmail.com
Mon Oct 14 07:22:37 UTC 2024
On 10.10.24 11:16, Alan Bateman wrote:
>
>
> On 10/10/2024 08:57, Michael Bien wrote:
>> Hello,
>>
>> Calls to System.exit() can be currently tracked by setting the
>> "java.lang.Runtime" logger to DEBUG (it even dumps the stack trace
>> which is nice). However, I couldn't find an equivalent for
>> Runtime.getRuntime().halt(). Are there plans to add more logging to
>> debug common JVM exit events?
>>
>> (if this was already discussed elsewhere - super sorry wasn't able to
>> find anything)
>
> Logging involves executing arbitrary Java so not for halt time. It's
> come up a few times, I think the most recent on core-libs-dev was Aug
> and/or Sept 2023, you'll need to search through the archives to find it.
Thanks! I found JDK-8301627 and JDK-8303198 and the discussion on the
PRs also gave some context.
+ https://www.mail-archive.com/core-libs-dev@openjdk.org/msg19309.html
(I made the mistake to mainly search through security manager threads
since I somehow expected that it would be discussed there too)
The JVM would still be able to log something to console (in native
beforeHalt() or halt0()) without the application/logging callback issue?
-Xlog:safepoint+stats=info seems to log some kind of exit cause, it is
the wrong way around though :)
System.exit() / halt() will print:
[0,419s][info][safepoint,stats] Exit 1
regular process exit (no-non daemon threads remaining) prints:
[0,454s][info][safepoint,stats] Halt 1
best regards,
michael
>
> -Alan
More information about the jdk-dev
mailing list