Java tutorial
//package com.java2s; import java.awt.EventQueue; public class Main { /** * Print a stack trace of the current thread. */ public static void printFullStackTrace() { Thread thread = Thread.currentThread(); System.out.printf(" Thread id: %d, name: %s, state: %s, daemon: %s, EDT: %s\n", thread.getId(), thread.getName(), thread.getState(), thread.isDaemon(), EventQueue.isDispatchThread()); ThreadGroup group = thread.getThreadGroup(); System.out.printf(" priority: %d, group: %s, group count: %d\n", thread.getPriority(), group.getName(), group.activeCount()); StackTraceElement[] backtrace = thread.getStackTrace(); for (StackTraceElement e : backtrace) { System.out.printf(" Stack Trace: %s\n", e); } } }