List of utility methods to do Stacktrace Print
String | printStackTrace(StackTraceElement[] stes, String filter) print Stack Trace StringBuilder sb = new StringBuilder(); for (StackTraceElement ste : stes) { if (filter == null || ste.getClassName().startsWith(filter)) { sb.append("\n\t").append("at ").append(ste.getClassName()).append(" (").append(ste.getFileName()) .append(":").append(ste.getLineNumber()).append(")"); return sb.toString(); ... |
void | printStackTrace(String header, int depth) print Stack Trace System.out.println(header); int i = 0; for (StackTraceElement se : Thread.currentThread().getStackTrace()) { System.out.println(se); if (i++ > depth) { break; |
void | printStackTrace(String msg, StackTraceElement[] trace, PrintStream out) Print given message, stack trace to the underlying print stream Exception ex = new Exception(msg);
ex.setStackTrace(trace);
ex.printStackTrace(out);
|
void | printStackTrace(String msg, Throwable throwable) print Stack Trace StringBuilder str = new StringBuilder( throwable.getClass().getName() + " : " + throwable.getMessage() + "(" + msg + ")\n"); str.append(stackTrace(throwable.getStackTrace())); System.err.println(str.toString()); Throwable cause = throwable.getCause(); if (cause != null) { printStackTrace(cause.getMessage(), cause); |
String | printStacktrace(Throwable aException) Dump a stack trace to a string ByteArrayOutputStream bout = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(bout); aException.printStackTrace(pw); pw.flush(); return new String(bout.toByteArray()); |
String | printStackTrace(Throwable e) print Stack Trace StringWriter stm = new StringWriter(); PrintWriter wrt = new PrintWriter(stm); e.printStackTrace(wrt); wrt.close(); return stm.toString(); |
String | printStackTrace(Throwable exception) print Stack Trace if (exception == null) { return ""; } else { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); exception.printStackTrace(pw); pw.flush(); String expString = sw.toString(); ... |
String | printStackTrace(Throwable t) Use with caution: lots of overhead StringWriter s = new StringWriter(); PrintWriter p = new PrintWriter(s); t.printStackTrace(p); return s.toString(); |
String | printStackTrace(Throwable t) print Stack Trace StringWriter strWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(strWriter); if (t != null) { t.printStackTrace(printWriter); return strWriter.getBuffer().toString(); |
String | printStackTrace(Throwable t) Print the full stack trace of a java.io.StringWriter strWriter = new java.io.StringWriter(); java.io.PrintWriter prWriter = new java.io.PrintWriter(strWriter); t.printStackTrace(prWriter); prWriter.flush(); return strWriter.toString(); |