将printStackTrace转换为string[@more@]String s = null;try {
throw new Exception("An exception thrown!");
} catch (Exception e) {
Writer w = new StringWriter();
e.printStackTrace(new PrintWriter(w));
s = w.toString();
}
System.out.println(s);
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/640706/viewspace-1044939/
,如需转载,请注明出处,否则将追究法律责任。