How can I get Stack trace as a string
public static String getStackTrace(Throwable t)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(bos);
t.printStackTrace(pw);
String output = pw.toString();
pw.close();
return output;
}