Java Patterns and Pitfalls     frequal.com
Helpful Stack Trace for Java Debugging

Helpful Stack Trace for Java Debugging

For quick, free, and easy stack inspection for your running Java program, put this code at the point you want to inspect the stack:
new Exception("Your message here").printStackTrace();
When this code is reached, the stack trace will be printed to standard output, along with your message. If you have a lot of output simply save it in a file and search for your string.

If you have a method which is called from several different locations and you need to know which caller is responsible, this can help.


Last modified on August 21, 2007 by AO

Copyright © 2007 Andrew Oliver