Java Stacktrace Print printStackTrace(PrintStream out)

Here you can find the source of printStackTrace(PrintStream out)

Description

print Stack Trace

License

Open Source License

Declaration

public static final void printStackTrace(PrintStream out) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.PrintStream;

public class Main {
    public static final void printStackTrace(PrintStream out) {
        StringBuilder sb = new StringBuilder();
        sb.append("Printing Stack Trace\n");
        for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
            sb.append('\t');
            sb.append(ste);/*from   w w w.  j av  a2 s. co  m*/
            sb.append('\n');
        }
        out.print(sb);
    }

    public static final void printStackTrace() {
        printStackTrace(System.err);
    }
}

Related

  1. printStackTrace(final Exception exception)
  2. printStackTrace(final StackTraceElement[] stack)
  3. printStackTrace(IOException ioe)
  4. printStackTrace(PrintStream out)
  5. PrintStackTrace(PrintStream out)
  6. printStackTrace(PrintStream out, StackTraceElement[] stackTrace)
  7. printStackTrace(PrintStream printStream, Thread thread, Throwable throwable)
  8. printStackTrace(PrintStream ps)
  9. printStackTrace(PrintStream ps, Exception e)