Java Dump Stracktrace dumpStack(boolean exit)

Here you can find the source of dumpStack(boolean exit)

Description

dump Stack

License

LGPL

Declaration

public static void dumpStack(boolean exit) 

Method Source Code

//package com.java2s;

import java.io.PrintWriter;
import java.io.StringWriter;

public class Main {
    public static void dumpStack(boolean exit) {
        try {//from   ww  w.j  a v  a 2  s.com
            throw new Exception("Dumping stack:");
        } catch (Exception e) {
            e.printStackTrace();
            //if(exit)
            //    System.exit(0);
        }
    }

    /**
     * Use with caution: lots of overhead
     */
    public static String printStackTrace(Throwable t) {
        StringWriter s = new StringWriter();
        PrintWriter p = new PrintWriter(s);
        t.printStackTrace(p);
        return s.toString();
    }
}

Related

  1. dumpCurrentStackTrace(PrintStream out)
  2. dumpStack()
  3. dumpStack(final PrintStream out, final int skip, final int depth)
  4. dumpStackTrace(int depth)