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
猜你喜欢
转载自blog.csdn.net/rdsuncn1977/article/details/54754918
今日推荐
周排行