public static String exceptionToString(Throwable th) {
String stTrace = "";
StringWriter sout = null;
PrintWriter out = null;
try {
sout = new StringWriter();
out = new PrintWriter(sout);
th.printStackTrace(out);
stTrace = sout.toString();
} catch (Exception ex) {
} finally {
try {
if (out != null)
out.close();
if (sout != null)
sout.close();
} catch (IOException ex) {
}
}
return stTrace;
}
捕捉Java的异常Stacktrace
最新推荐文章于 2023-08-20 23:03:52 发布