java获得异常的详细StackTrace

  • 2019-12-18
  • 0
  • 1

将异常的详细StackTrace提取成字符串
然后进行相应的操作

StringWriter sw = new StringWriter();  
PrintWriter pw = new PrintWriter(sw);  
e.printStackTrace(pw);  
String msg=sw.toString();

评论