[jboss-jira] [JBoss JIRA] Updated: (JBAS-4432) Log4J does not output JSF 1.2 implementation logging messages
Stan Silvert (JIRA)
jira-events at lists.jboss.org
Mon May 21 15:51:52 EDT 2007
[ http://jira.jboss.com/jira/browse/JBAS-4432?page=all ]
Stan Silvert updated JBAS-4432:
-------------------------------
Fix Version/s: JBossAS-5.0.0.Beta3
JBossAS-4.2.1.CR1
Thanks for pointing this out. There is a related logging issue that will be fixed in the next patch of the JSF Implementation. I'll take care of this issue when the new JSF impl is released.
> Log4J does not output JSF 1.2 implementation logging messages
> --------------------------------------------------------------
>
> Key: JBAS-4432
> URL: http://jira.jboss.com/jira/browse/JBAS-4432
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: JavaServerFaces
> Affects Versions: JBossAS-4.2.0.GA
> Reporter: Anastasios Georgousakis
> Assigned To: Stan Silvert
> Fix For: JBossAS-4.2.1.CR1, JBossAS-5.0.0.Beta3
>
>
> JSF uses java logging to output logging messages. JBoss include org.jboss.web.jsf.integration.config.JBossJSFConfigureListener to set a filter in java logging system in order logging messages to be handled from log4j. The problem is that setting only the filter is not enough because JSF implementation is checking if level is configured before calling a method to out put a message.
> e.g
> if (LOGGER.isLoggable(Level.FINE)) {
> LOGGER.fine("Converting buffered ServletOutputStream bytes"
> + " to chars using " + encoding);
> }
> If you define in jboss-log4j.xml to enable logging for JSF implementation this will not have any effect and JSF messages will not be displayed. A workaround is to change the level of JSF logging if you find that specific levels are enabled in log4j configuration.
> I changed setLog4J in JBossJSFConfigureListener to set java logging levels for JSF logging categories with the following code.
> /**
> * If Log4J is being used, set a filter that converts JSF RI java.util.logger
> * messages to Log4J messages.
> */
> private void setLog4J()
> {
> Filter conversionFilter = new Log4JConversionFilter(logConfigMessages());
>
> setLog4JFilter(Util.FACES_LOGGER, conversionFilter);
> setLog4JFilter(Util.FACES_LOGGER + Util.APPLICATION_LOGGER, conversionFilter);
> setLog4JFilter(Util.FACES_LOGGER + Util.CONFIG_LOGGER, conversionFilter);
> setLog4JFilter(Util.FACES_LOGGER + Util.CONTEXT_LOGGER, conversionFilter);
> setLog4JFilter(Util.FACES_LOGGER + Util.LIFECYCLE_LOGGER, conversionFilter);
> setLog4JFilter(Util.FACES_LOGGER + Util.RENDERKIT_LOGGER, conversionFilter);
> setLog4JFilter(Util.FACES_LOGGER + Util.TAGLIB_LOGGER, conversionFilter);
> }
>
> private void setLog4JFilter(String loggername, Filter conversionFilter) {
> java.util.logging.Logger jdkLogger = java.util.logging.Logger.getLogger(loggername);
> jdkLogger.setFilter(conversionFilter);
> Logger jbossLogger = Logger.getLogger(loggername);
> if(jbossLogger.isTraceEnabled())
> jdkLogger.setLevel(Level.FINEST);
> else if(jbossLogger.isDebugEnabled())
> jdkLogger.setLevel(Level.FINE);
> else if(jbossLogger.isInfoEnabled())
> jdkLogger.setLevel(Level.INFO);
> }
--
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
More information about the jboss-jira
mailing list