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()??
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 ]