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.
24 lines
455 B
Java
24 lines
455 B
Java
|
2 years ago
|
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();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|