List of utility methods to do Stacktrace
void | deeplyPrint(Throwable e, PrintStream strm, boolean stackTrace) deeply Print deeplyPrint(e, strm, stackTrace, 0); |
void | stackTrace() Create a fake stack trace try { throw new Exception("STACK TRACE"); } catch (Exception e) { e.printStackTrace(); |
void | stackTrace() Print the current stack trace. StackTraceElement[] trace = Thread.currentThread().getStackTrace(); boolean b = false; for (StackTraceElement e : trace) { System.out.println(e.getClassName() + "." + e.getMethodName() + "(" + e.getFileName() + ":" + e.getLineNumber() + ")"); if (e.getMethodName().equals("stackTrace") && e.getClassName().endsWith("Utils")) { if (b) { return; ... |
String | stackTrace() stack Trace StackTraceElement[] elements = Thread.currentThread().getStackTrace(); StringBuilder buf = new StringBuilder(); for (StackTraceElement element : elements) { buf.append("\r\n ").append(element.getClassName()).append(".").append(element.getMethodName()) .append("(").append(element.getFileName()).append(":").append(element.getLineNumber()) .append(")"); return buf.toString(); ... |
String | stackTrace() stack Trace StackTraceElement[] elements = Thread.currentThread().getStackTrace(); StringBuilder sb = new StringBuilder(); for (int i = 2; i < elements.length; i++) { StackTraceElement s = elements[i]; sb.append("\tat " + s.getClassName() + "." + s.getMethodName() + "(" + s.getFileName() + ":" + s.getLineNumber() + ")\n"); return sb.toString(); ... |
String | stacktrace() stacktrace try { throw new Exception(); } catch (Exception e) { StackTraceElement[] trace = e.getStackTrace(); StringBuilder sb = new StringBuilder(); for (int i = 1; i < trace.length; i++) { StackTraceElement stackTraceElement = trace[i]; sb.append(stackTraceElement.toString()); ... |
void | stackTrace(final Exception t) Since calling Exception#printStackTrace() is considered a bad practice, we wrap all these calls with this method to prevent static code analysis from complaning. t.printStackTrace(System.err); |
String | stackTrace(final Throwable caught) stack Trace StringBuffer sb = new StringBuffer(1024); sb.append("<pre>"); stackTrace(caught, sb); sb.append("</pre>"); return sb.toString(); |
void | stackTrace(int depth) stack Trace int offset = 3; if (depth == 0) depth = 4; StackTraceElement[] seArray = Thread.currentThread().getStackTrace(); if (seArray.length > offset) { System.out.println("Displaying " + depth + " of " + seArray.length + " stack trace elements"); for (int index = offset; index < Math.min(depth + offset, seArray.length + offset); index++) System.out.println(" " + seArray[index].getClassName() + "." + seArray[index].getMethodName() ... |
String | stackTrace(StackTraceElement[] stackTrace) stack Trace StringBuilder str = new StringBuilder(""); for (StackTraceElement s : stackTrace) { str.append("\t").append(s.getClassName() + "." + s.getMethodName() + "(" + s.getFileName() + ":" + s.getLineNumber() + ")" + "\n"); return str.toString(); |