Here you can find the source of formatStackTrace(Exception error)
Parameter | Description |
---|---|
error | exception which will be formated into string |
public static String formatStackTrace(Exception error)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a v a 2 s . c om*/ * * @param error exception which will be formated into string * @return stack trace as string */ public static String formatStackTrace(Exception error) { final StringBuffer br = new StringBuffer(); StackTraceElement[] elem = error.getStackTrace(); for (int i = 0; i < elem.length; i++) br.append(elem[i].toString() + "\n"); return br.toString(); } }