Java examples for java.lang:Throwable
get Stacktrace
public class Main{ public static String getStacktrace(Exception ex) { StringBuilder msg = new StringBuilder(); if (null != ex) { msg.append(ex.getMessage()); StackTraceElement[] stackList = ex.getStackTrace(); if (null != stackList) { for (StackTraceElement el : stackList) { msg.append(EnvironmentUtil.newLine()); msg.append(el.toString()); }/*from w w w .ja v a 2 s . co m*/ } } return msg.toString(); } }