Here you can find the source of exceptionToString(Throwable e)
public static String exceptionToString(Throwable e)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . java 2 s . co m*/ * Returns a String representation of Exception + stacktrace */ public static String exceptionToString(Throwable e) { return exceptionToString(e, false); } /** * Returns a String rep. of Exception type + stacktrace * @param throwable * @param miniStack - if true, returns only stacktrace elements w line numbers */ public static String exceptionToString(Throwable throwable, boolean miniStack) { if (throwable == null) return "null"; StringBuffer s = new StringBuffer(throwable + "\n"); StackTraceElement[] stes = throwable.getStackTrace(); for (int i = 0; i < stes.length; i++) { String ste = stes[i].toString(); if (!miniStack || ste.matches(".*[0-9]+\\)")) s.append(" " + ste + "\n"); } return s.toString(); } }