Print the Stack Trace of the Exception to a String
import java.io.PrintWriter;
import java.io.StringWriter;
public static String getStackTrace(Throwable t)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
t.printStackTrace(pw);
pw.flush();
sw.flush();
return sw.toString();
}
posted on 2007-04-17 17:24 lqx 閱讀(220) 評(píng)論(0) 編輯 收藏