Here you can find the source of getStackTrace(Throwable t)
public static String getStackTrace(Throwable t)
//package com.java2s; //License from project: LGPL import java.io.*; public class Main { public static String getStackTrace(Throwable t) { return printStackTrace(t); }//from www . j a v a 2 s.c o m /** * Use with caution: lots of overhead */ public static String printStackTrace(Throwable t) { StringWriter s = new StringWriter(); PrintWriter p = new PrintWriter(s); t.printStackTrace(p); return s.toString(); } }