Here you can find the source of getExceptionDetails (final Throwable e)
public static String getExceptionDetails (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 getExceptionDetails(final Throwable e) { return getExceptionDetails(e, ""); }/*from ww w .j a v a 2s . c om*/ public static String getExceptionDetails(final Throwable e, final String preamble) { return getExceptionDetails(e, preamble, true); } public static String getExceptionDetails(final Throwable e, final String preamble, final boolean includeContextId) { final StringBuilder result = new StringBuilder(); final String stackTrace = getStackTrace(e); final String formatSpecifier = "%s%n%s"; final String s = includeContextId ? contextFormatMessage( formatSpecifier, preamble, stackTrace) : String.format( formatSpecifier, preamble, stackTrace); result.append(s); // Remove trailing newline. return result.toString().trim(); } public static String getStackTrace(final Throwable e) { final Writer sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); return sw.toString(); } public static String contextFormatMessage(final String format, final Object... parameters) { return String.format(format, parameters); } /** Varargs wrapper */ public static String toString(final Object... objects) { return Arrays.toString(objects); } }