Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Java Tip 124: Trace your steps in Java 1.4

Locate runtime code with getStackTrace()

  • Print
  • Feedback

Page 4 of 4

Location, location, location!

Well, there you have it: everything you need to know to find where you are and how you got there -- well, at least in your Java code. When coding, this trick is useful for simple logging and tracing needs, but I suggest you check out full-blown logging packages, such as the new Java Logging API or Log4J, which handle more details than just gathering information for you. And one final piece of advice: When traveling, do remember to stop and ask for directions. Your traveling companions may not enjoy your "Zen driving" experiment.

About the author

John D. Mitchell is the contributing editor of JavaWorld's Tips 'N Tricks column. John is also the founder and chief architect of Non, Inc. -- a technological business risk-management consulting practice.
  • Print
  • Feedback

Resources