Hello.

I have an exception that wraps other exceptions. I would like to log my own message and the message from the original exception's getMessage() method. I also want to log a system-generated exception ID that is created in the constructor of my wrapper exception. I want the log message and my wrapper exception's message to include the class and method name of where the message was logged. So, my exception needs information from log4j, and log4j needs information from my exception. Also, I have a class that converts SQLException into my own (more specifiic) exceptions by examining the error code inside SQLException.

The book has a chapter on MDC and NDC, but the information in the diagnostic contexts applies to a thread, not to a specific exception. I've also considered using Ceki's Logger wrapper, but I'm wondering if there is a way to do this without extending log4j (although I'm very willing to extend log4j, if necessary).

Also, I read in the book that the %M (along with %C, %F, %l, and %L) "can be excruciatingly slow." Does anyone know of a better way to get the method name of the calling class? Is using a rendered object that contains the method name a good idea?

I've tried all of this a few ways, but none of them are elegant. Does anyone have any ideas?

Thanks,

Bob


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to