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