如何将堆栈跟踪转换为字符串? [英] How can I convert a stack trace to a string?
本文介绍了如何将堆栈跟踪转换为字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将 Throwable.getStackTrace()
的结果转换为描述堆栈跟踪的字符串的最简单方法是什么?
What is the easiest way to convert the result of Throwable.getStackTrace()
to a string that depicts the stacktrace?
推荐答案
可以使用以下方法将 Exception
堆栈跟踪转换为 String
.此类在 Apache commons-lang 中可用,这是最常见的依赖库,具有许多流行的开源
One can use the following method to convert an Exception
stack trace to String
. This class is available in Apache commons-lang which is most common dependent library with many popular open sources
org.apache.commons.lang.exception.ExceptionUtils.getStackTrace(Throwable)
这篇关于如何将堆栈跟踪转换为字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文