Logging JVM exit (in context of JEP 486)
Baesken, Matthias
matthias.baesken at sap.com
Mon Oct 14 11:03:51 UTC 2024
Maybe not exactly what you want, but there is also the JFR Shutdown event https://sap.github.io/SapMachine/jfrevents/21.html#shutdown .
This is generated in JVM_BeforeHalt :
https://github.com/openjdk/jdk/blob/037f11b864734734dd7fbce029b2e8b4bc17f3ab/src/hotspot/share/prims/jvm.cpp#L436
( my colleague Johannes also mentioned the JVM shutdown hooks - might be also interesting for you https://www.baeldung.com/jvm-shutdown-hooks )
Best regards, Matthias
>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
More information about the jdk-dev
mailing list