[英]Outputing call stack in addition to exception name and description in java application
I executing a java application and I see some exception but not call stack. 我执行一个Java应用程序,但看到一些异常,但没有调用堆栈。 Can I somehow see callstack as well?
我还能以某种方式看到调用栈吗? It would let me better understand what is the problem.
这会让我更好地了解问题所在。
printStackTrace()
或getStackTrace()
吗?
You can call an Exception
object's printStackTrace()
method. 您可以调用
Exception
对象的printStackTrace()
方法。
try{
//code
}catch(Exception ex){
ex.printStackTrace();
}
You might consider using a logger instead 您可以考虑改用记录器
try{
//code
}catch(Exception ex){
LOG.warn("whatever went wrong", ex);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.