Java Stacktrace stackTrace()

Here you can find the source of stackTrace()

Description

stack Trace

License

Apache License

Declaration

public static String stackTrace() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String stackTrace() {
        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(")");
        }//from   w  w  w .  j a  v a 2 s  .com
        return buf.toString();
    }
}

Related

  1. deeplyPrint(Throwable e, PrintStream strm, boolean stackTrace)
  2. stackTrace()
  3. stackTrace()
  4. stacktrace()
  5. stackTrace()
  6. stackTrace(final Exception t)