public class ExceptionUtil {
/**
* 打印异常的堆栈信息
*/
public static String getStackTrace(Throwable throwable) {
try(StringWriter sw = new StringWriter();PrintWriter pw = new PrintWriter(sw)) {
throwable.printStackTrace(pw);
return sw.toString();
} catch (Exception e) {
}
return "";
}
}