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 sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); e.printStackTrace(pw);//from w w w . j a va2s . c o m pw.flush(); sw.flush(); String rv = sw.toString(); String[] s = rv.split("\\n", 65); if (s.length < 65) return rv; rv = ""; for (int i = 0; i < 64; i++) rv += s[i] + "\n"; return rv; } }