[
http://jira.jboss.com/jira/browse/JBSEAM-2598?page=comments#action_12399807 ]
Christian Bauer commented on JBSEAM-2598:
-----------------------------------------
I've done some hacking to get rid of the log.errors() that are scattered across our
code. If the exception handler is called after an exception, log the exception as WARN
before the handler gets it, not ERROR:
Index: src/main/org/jboss/seam/jsf/SeamPhaseListener.java
===================================================================
--- src/main/org/jboss/seam/jsf/SeamPhaseListener.java (revision 7434)
+++ src/main/org/jboss/seam/jsf/SeamPhaseListener.java Tue Feb 19 07:41:30 CET 2008
@@ -196,7 +196,7 @@
}
catch (Exception e)
{
- log.error("uncaught exception", e);
+ log.warn("uncaught exception, passing to exception handler", e);
try
{
Exceptions.instance().handle(e);
Index: src/main/org/jboss/seam/web/ExceptionFilter.java
===================================================================
--- src/main/org/jboss/seam/web/ExceptionFilter.java (revision 7434)
+++ src/main/org/jboss/seam/web/ExceptionFilter.java Tue Feb 19 07:47:43 CET 2008
@@ -65,8 +65,8 @@
}
catch (Exception e)
{
- log.error( "handling uncaught exception", e );
- log.error( "exception root cause", EJB.getCause(e) );
+ log.warn( "handling uncaught exception", e );
+ log.warn( "exception root cause", EJB.getCause(e) );
endWebRequestAfterException( (HttpServletRequest) request, (HttpServletResponse)
response, e);
}
}
@@ -79,7 +79,7 @@
// the PhaseListener probably does it, but we want to
// make sure of that...
- log.debug("running exception handlers");
+ log.warn("running exception handlers");
//the FacesContext is gone - create a fake one for Redirect and HttpError to call
MockFacesContext facesContext = createFacesContext(request, response);
facesContext.setCurrent();
So that already reduces the logging of _the same exception_ by two. I'm still getting
the exception logged three times more, with the same log+rethrow/handle pattern from other
libraries, will try to look into that:
07:57:40,549 ERROR [STDERR] Feb 19, 2008 7:57:40 AM com.sun.facelets.FaceletViewHandler
handleRenderException
[stacktrace]
07:57:40,572 ERROR [STDERR]
pt.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
[some other stacktrace, no idea what this is]
07:57:40,574 WARN [javax.enterprise.resource.webcontainer.jsf.lifecycle]
executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@740f7e) threw
exception
[again the same as the first stacktrace]
Exception handling - Never log and handle an exception, do one or the
other
---------------------------------------------------------------------------
Key: JBSEAM-2598
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2598
Project: JBoss Seam
Issue Type: Feature Request
Components: Core
Reporter: Shane Bryzak
Fix For: 2.1.0.GA
Either I see my exception in the log (because it is one of the VERY
RARE silently recoverable exceptions - I would not know a single one)
or it is handled by my exception handler. Actually, I should never see
an exception in my log unless I say so in my exception handler. I've
seen Shane doing some commits about this but he only made logging
configurable in Exceptions.handle(), which runs AFTER
SeamPhaseListener already dumps a log.error("Uncaught exception", e).
So basically, you can now configure if you want an exception logged
twice or just once. This is btw killing me in production because my
log fills up with login-password failures if someone makes a typo.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira