*scratch*

vijay's weblog

« Back to posts
  • Viewed
    times
September 7, 2010

Thread.dumpStack()

  • Edit
  • Delete
  • Tags
  • Autopost

To print a stack trace in Java, without throwing an exception, call Thread.dumpStack(). The output will go to System.err. This could be redirected to a log file or some other output stream:

PrintStream logFile;

// ...

System.setErr(logFile);
Thread.dumpStack();
Tweet
  • 0 responses
  • Like
  • Comment