Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Beginner
Mar 24, 1999

Display the Stack Trace

The stack trace is a useful debugging tool that you'll normally take advantage of when an exception has been thrown. It provides information on the execution history of the current thread, displaying the names of the classes and methods within those classes that had been called at the point when the exception occurred. However, there are times when it's helpful to display the stack trace even though an exception has not been thrown. The easiest way to do this is to use the static dumpStack() method in the Thread class:
 
Thread.dumpStack();
This technique is useful, for example, when you have a method that is called from a variety of places within your code and you want to learn where it is being called from when a particular problem occurs.
Brett Spell
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap