直接上方法
/**
* 获取错误的堆栈信息
* @param throwable
* @return
*/
public String getStackTrace(Throwable throwable){
StringWriter stringWriter=new StringWriter();
PrintWriter printWriter=new PrintWriter(stringWriter);
try {
throwable.printStackTrace(printWriter);
return stringWriter.toString();
}finally {
printWriter.close();
}
}