Java Utililty Methods Dump Stracktrace

List of utility methods to do Dump Stracktrace

  1. HOME
  2. Java
  3. D
  4. Dump Stracktrace

Description

The list of methods to do Dump Stracktrace are organized into topic(s).

Method

void dumpCurrentStackTrace(PrintStream out)
Used to track down which tests are still doing things that should really be done only in development
for (StackTraceElement e : Thread.currentThread().getStackTrace()) {
 System.out.println("\t" + e);
String dumpStack()
Method dumpStack.
return dumpStack(new Throwable());
void dumpStack(boolean exit)
dump Stack
try {
 throw new Exception("Dumping stack:");
} catch (Exception e) {
 e.printStackTrace();
void dumpStack(final PrintStream out, final int skip, final int depth)
dump Stack
dumpStack(out, new Exception(""), skip + 1, depth);
String dumpStackTrace(int depth)
dump Stack Trace
StringBuilder sb = new StringBuilder();
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
for (int i = 0; i < stackTrace.length && i < depth; i++) {
 StackTraceElement se = stackTrace[i];
 sb.append(" - " + se.getClassName() + "#" + se.getMethodName() + ":" + se.getLineNumber() + "\n");
return sb.toString();

AltStyle によって変換されたページ (->オリジナル) /