jvm不打印异常栈
Posted 倾听与积累
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jvm不打印异常栈相关的知识,希望对你有一定的参考价值。
生产环境抛异常,但却没有将堆栈信息输出到日志,确认打印日志方法正确logger.error("somthing error", ex);
JVM启动参数加上-XX:-OmitStackTraceInFastThrow(减号表示关闭,加号则表示启用)
原因参考
http://www.oracle.com/technetwork/java/javase/relnotes-139183.html#vm
The compiler in the server VM now provides correct stack backtraces for all "cold" built-in exceptions. For performance purposes, when such an exception is thrown a few times, the method may be recompiled. After recompilation, the compiler may choose a faster tactic using preallocated exceptions that do not provide a stack trace. To disable completely the use of preallocated exceptions, use this new flag: -XX:-OmitStackTraceInFastThrow.
以上是关于jvm不打印异常栈的主要内容,如果未能解决你的问题,请参考以下文章