package com.taotao.utils; import java.io.PrintWriter; import java.io.StringWriter; public class ExceptionUtil { /** * 获取异常的堆栈信息 * * @param t * @return */ public static String getStackTrace(Throwable t) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try { t.printStackTrace(pw); return sw.toString(); } finally { pw.close(); } } }
ExceptionUtil(异常使用工具类)
猜你喜欢
转载自www.cnblogs.com/a-fun/p/9359922.html
今日推荐
周排行