• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pretty print exceptions

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A common solution when encountering exceptions is the "ugly" printstacktrace() in order to get enough information printed to fully understand the reason the exception occured.

Such stacktraces seldom do well in logs, and by java 1.4 there is a new method on Throwable which seems to make it easier to extract information from the exception/stacktrace...

However applications can be run on VM prior to 1.4, so this solution is not suitable...

My question ::
Does anyone know of some open source project or equivalent which deals with the problem of extracting information from exceptions, making it possible to make more reasonable logstatements than the damn printStackTrace()??
 
Ranch Hand
Posts: 284
Netbeans IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Rune,
Have you thought about dealing with de getStackTrace() method of Throwable?. The zeroth element of the StackTraceElement[] returned provides information about the last method invoked.
I think this in addition to the toString() method gives a reasonable information.

[ November 30, 2004: Message edited by: Ignacio del Valle ]

[ November 30, 2004: Message edited by: Ignacio del Valle ]
[ December 02, 2004: Message edited by: Ignacio del Valle ]
 
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic