Here you can find the source of getExceptionStackTrace(Throwable ex)
public static String getExceptionStackTrace(Throwable ex)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String getExceptionStackTrace(Throwable ex) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw);//from w w w. j a v a 2s . c om pw.close(); return sw.toString(); } }