Java 获取Exception详细信息,Java获取异常详细内容
================================
©Copyright 蕃薯耀 2021-01-29
https://www.cnblogs.com/fanshuyao/
import java.io.PrintWriter; import java.io.StringWriter; public class ErrorMsgUti { public static String getErrorMsg(Throwable thr) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter= new PrintWriter(stringWriter); try { thr.printStackTrace(printWriter); return stringWriter.toString(); } finally { if(printWriter != null) { printWriter.close(); } } } }
================================
©Copyright 蕃薯耀 2021-01-29
https://www.cnblogs.com/fanshuyao/