Here you can find the source of getStackTrace (final Throwable e)
public static String getStackTrace (final Throwable e)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.util.Arrays; public class Main { public static String getStackTrace(final Throwable e) { final Writer sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw);// www.j a v a 2 s .c o m return sw.toString(); } /** Varargs wrapper */ public static String toString(final Object... objects) { return Arrays.toString(objects); } }