Return to Snippet

Revision: 46280
at May 16, 2011 20:39 by ziuek


Initial Code
public static String stack2string(Exception e) {

		try {
			StringWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			e.printStackTrace(pw);
			return "------
" + sw.toString() + "------
";
		} catch (Exception e2) {
			return "bad stack2string";
		}
	}

Initial URL
http://www.rgagnon.com/javadetails/java-0029.html

Initial Description

                                

Initial Title
Print stack trace to string

Initial Tags
java

Initial Language
Java