Here you can find the source of getStacktraceAsString(Exception e)
public static String getStacktraceAsString(Exception e)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String getStacktraceAsString(Exception e) { StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); return errors.toString(); }//w ww . ja va2s.c om }