Exception e or throwable e
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
System.out.println("异常信息:" + sw.getBuffer().toString()); // 打印出异常堆栈信息
打印异常堆栈信息的方式
最新推荐文章于 2024-07-09 19:57:32 发布
Exception e or throwable e
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
System.out.println("异常信息:" + sw.getBuffer().toString()); // 打印出异常堆栈信息