package com.bjshenpu.spcloud.dajia.utils; import java.io.PrintWriter; import java.io.StringWriter; public class ExcrptionUtils { /* Converts a Throwable object's stack trace to a string. * @param t the Throwable object to convert * @return a string representation of the stack trace */ public static String printStackTraceToString(Throwable t) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw, true)) { t.printStackTrace(pw); } return sw.toString(); } }
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交