First, I throw runtime exceptions for all fatal exceptions, so these exceptions are moved to the container where I currently use the error page (defined in web.xml). On this error page is the scriptlet that calls the registrar.
The problem I ran into is that the exception is no longer on the stack on this call. I have access to it from a query scope variable ("javax.servlet.error.message"). This line is a stack trace. I need this stack trace for logging purposes, and on different application servers, "javax.error_message" can be disabled for security reasons ........
So my question is how best to catch runtime exceptions from Java EE applications without wrapping everything in this:
try {} catch (Exception e) {logger.log(...)}
?
I want some way to call a logger from a container, perhaps right before the container catches the exception, for example.
source
share