Throwable堆栈信息 转 String
public static String stackTraceToString(Throwable e) { try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(byteArrayOutputStream)) { e.printStackTrace(printStream); return byteArrayOutputStream.toString(); } catch (IOException ex) { throw new RuntimeException(ex); } }