RFR: 8358080: Print thread stack with -Xlog:exceptions=trace

Ioi Lam iklam at openjdk.org
Thu May 29 16:44:28 UTC 2025


This makes it easier to analyze exceptions without modifying the JVM or the app to print call stacks:


$ java -Xlog:exceptions=trace -cp foo.jar Foo
[2.047s][info ][exceptions] Exception <a 'java/lang/NullPointerException'{0x00000004736ab200}>
[ ] thrown in interpreter method <{method} {0x000070488c9f2a50} 'isLoggable' '(Ljava/lang/System$Logger$Level;)Z' in 'jdk/internal/logger/AbstractLoggerWrapper'>
[ ] at bci 5 for thread 0x000070499802e730 (DestroyJavaVM)
[2.048s][trace][exceptions] at jdk.internal.logger.AbstractLoggerWrapper.isLoggable([java.base at 25-internal](mailto:java.base at 25-internal)/AbstractLoggerWrapper.java:68)
[2.048s][trace][exceptions] at java.lang.ProcessBuilder.start([java.base at 25-internal](mailto:java.base at 25-internal)/ProcessBuilder.java:1093)
[2.048s][trace][exceptions] at java.lang.ProcessBuilder.start([java.base at 25-internal](mailto:java.base at 25-internal)/ProcessBuilder.java:1044)
[2.048s][trace][exceptions] at jdk.internal.misc.CDS$ProcessLauncher.execWithJavaToolOptions([java.base at 25-internal](mailto:java.base at 25-internal)/CDS.java:548)

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

Commit messages:
 - 8358080: Print thread stack with -Xlog:exceptions=trace

Changes: https://git.openjdk.org/jdk/pull/25522/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25522&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8358080
  Stats: 10 lines in 1 file changed: 10 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/25522.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25522/head:pull/25522

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


More information about the hotspot-dev mailing list