0

I'm trying to clean up server logs in my JSF 2 application so it's less cluttered. That means for example not to log exceptions that i expect and is not at all interested in. For this, I've built my own error handler using the technique described at http://jugojava.blogspot.com/2010/09/jsf-2-exception-handling.html.

However, all exceptions thrown in my managed beans are logged several times before reaching my error handlar, first by javax.enterprise.resource.webcontainer.jsf.application, and after that by javax.enterprise.resource.webcontainer.jsf.lifecycle. Is it possible to prevent these classes from logging every single exception twice? I'd rather not mute those classes in log4j since they might log other useful information.

Example, NPE in managed bean. The last row is the only logged on purpose.
ALLVARLIG means "SERIOUS" and VARNING means "WARNING"):

2012-02-01 07:32:43,477 ALLVARLIG [javax.enterprise.resource.webcontainer.jsf.application] (http-0.0.0.0-80-33) java.lang.NullPointerException: javax.faces.el.EvaluationException: java.lang.NullPointerException
[full stack trace]
2012-02-01 07:32:43,477 VARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-0.0.0.0-80-33) #{myController.doStuff}: java.lang.NullPointerException: javax.faces.FacesException: #{myController.doStuff}: java.lang.NullPointerException
[full stack trace]
2012-02-01 07:32:43,477 ERROR [com.mycompany.myapplication.controller.error.ErrorHandler] (http-0.0.0.0-80-33) Unknown error: javax.faces.FacesException: #{myController.doStuff}: java.lang.NullPointerException
[full stack trace]
Rasmus Franke
  • 4,434
  • 8
  • 45
  • 62
  • Related: http://stackoverflow.com/questions/7162134/in-jsf-1-2-how-do-i-changing-logging-level-of-renderresponsephase – BalusC Feb 02 '12 at 12:48
  • Hmm didn't realize the log messages went through java.util.Logging rather than log4j, but now it seems pretty obvious with the different names of log levels. – Rasmus Franke Feb 02 '12 at 13:15

0 Answers0