Here you can find the source of stackTraceAsString(Throwable e)
public static String stackTraceAsString(Throwable e)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String stackTraceAsString(Throwable e) { String stackAsString = ""; if (e != null) { StringWriter writer = new StringWriter(); PrintWriter pw = new PrintWriter(writer); e.printStackTrace(pw);/* w ww. j ava 2s .c om*/ stackAsString = writer.toString(); } return stackAsString; } }