File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pretty print exceptions

 
Rune Skjelvik
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • 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()??
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic