List of utility methods to do Stacktrace Print
void | PrintStackTrace(PrintStream out) Print Stack Trace try { throw new Exception("Stack Trace:"); } catch (Exception e) { e.printStackTrace(out); |
void | printStackTrace(PrintStream out) print Stack Trace StringBuilder sb = new StringBuilder(); sb.append("Printing Stack Trace\n"); for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { sb.append('\t'); sb.append(ste); sb.append('\n'); out.print(sb); ... |
void | printStackTrace(PrintStream out, StackTraceElement[] stackTrace) print Stack Trace for (int i = 2; i < stackTrace.length; i++) { StackTraceElement stackTraceElement = stackTrace[i]; out.println("\tat " + stackTraceElement); |
void | printStackTrace(PrintStream printStream, Thread thread, Throwable throwable) print Stack Trace StringBuilder stringBuilder = new StringBuilder(1500); stringBuilder.append('[').append(thread.getName()).append(" thread] exception : ").append(throwable) .append(System.lineSeparator()); StackTraceElement[] stackTraceElements = throwable.getStackTrace(); for (StackTraceElement element : stackTraceElements) stringBuilder.append(" at ").append(element).append(System.lineSeparator()); Throwable cause; while ((cause = throwable.getCause()) != null) { ... |
void | printStackTrace(PrintStream ps) print Stack Trace if (ps == null) { throw new IllegalArgumentException("PrintStream is null"); try { throw new Exception(); } catch (Exception ex) { ps.println(getStackTrace(ex)); |
void | printStackTrace(PrintStream ps, Exception e) print Stack Trace if (e == null) print(ps, getStackTrace()); else print(ps, stackTraceToString(e.getStackTrace())); |
void | printStackTrace(PrintWriter writer, Thread thread, StackTraceElement[] trace) print Stack Trace try { writer.println(thread.toString() + ":"); for (int i = 0; i < trace.length; i++) writer.println("\tat " + trace[i]); } catch (Exception e) { writer.println("\t*** Exception printing stack trace: " + e); writer.flush(); ... |
List | printStackTrace(StackTraceElement[] elements) print Stack Trace List<String> stackTrace = new ArrayList<>(); String last = null; boolean lastWasTabbed = false; for (StackTraceElement element : elements) { if (last == null) { stackTrace.add(element.toString()); last = element.toString(); continue; ... |
void | printStackTrace(StackTraceElement[] elements) print Stack Trace for (StackTraceElement stackTraceElement : elements) { System.err.println(stackTraceElement.toString()); System.err.println(""); |
String | printStackTrace(StackTraceElement[] stackTrace) print Stack Trace StringBuilder sb = new StringBuilder(); for (StackTraceElement s : stackTrace) { sb.append(s.toString()); sb.append("\n"); return sb.toString(); |