You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dianshang-houduan/src/main/java/com/sztzjy/trade/util/ThrowableUtil.java

24 lines
455 B
Java

package com.sztzjy.trade.util;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* 异常工具
*
* 陈沅
*/
public class ThrowableUtil {
/**
* 获取堆栈信息
*/
public static String getStackTrace(Throwable throwable) {
StringWriter sw = new StringWriter();
try (PrintWriter pw = new PrintWriter(sw)) {
throwable.printStackTrace(pw);
return sw.toString();
}
}
}