Saturday, February 6, 2010

Stack Trace of the Exception to a String

Use this code inside your catch block. This will return a string.

}catch(Exception e){

StringWriter sWriter = new StringWriter();
e.printStackTrace(new PrintWriter(sWriter));
System.out.println(sWriter.getBuffer().toString()) ;

}

No comments:

Post a Comment