Version 19

    Controlling log messages from the JSF implementation and Facelets

    The JSF implementation and Facelets both use java.util.logging instead of Log4J.  So all java.util.logging messages from JSF and Facelets will be converted to Log4J on the fly.

     

    For JBoss 5, JBoss 4.3, and JBoss 4.2 EAP, it is possible to control the logging messages that come from the JSF implementation.  This can be especially useful in debugging.

     

    Currently, the JSF implementation uses only 8 loggers.  The names are as follows:

     

    Logger Name

    javax.enterprise.resource.webcontainer.jsf.managedbean

    javax.enterprise.resource.webcontainer.jsf.renderkit

    javax.enterprise.resource.webcontainer.jsf.taglib

    javax.enterprise.resource.webcontainer.jsf.application

    javax.enterprise.resource.webcontainer.jsf.context

    javax.enterprise.resource.webcontainer.jsf.config

    javax.enterprise.resource.webcontainer.jsf.lifecycle

    javax.enterprise.resource.webcontainer.jsf.timing

     

    So, assuming I have an appender called JSFLOG, I can edit jboss-log4j.xml to change the priority level for loggers in the JSF implementation like this:

       <category name="javax.enterprise.resource.webcontainer.jsf.config">
         <priority value="ALL" ></priority>
         <appender-ref ref="JSFLOG"></appender-ref>
       </category>
    
       <category name="javax.enterprise.resource.webcontainer.jsf.lifecycle">
         <priority value="WARN" ></priority>
         <appender-ref ref="JSFLOG"></appender-ref>
       </category>
    

     

    We automatically detect if you are using Facelets.  If so, we do the same kind of conversion to Log4J.  The logger names are as follows:

    Logger Name

    facelets.compiler

    facelets.factory

    facelets.tag.component

    facelets.viewhandler

    facelets.tag.meta

     

    You can control the priority level in jboss-log4j.xml.  In this example, we restrict all Facelets message to ERROR level by setting the category name to "facelets".  We could have done the same sort of thing in the example above by setting the category name to "javax.enterprise.resource.webcontainer.jsf".

       <category name="facelets">
         <priority value="ERROR" ></priority>
         <appender-ref ref="JSFLOG"></appender-ref>
       </category>
    

     

     

    Note: If you change a category's priority after your JSF application is loaded then you will need to hot-deploy the JSF application for the new priority to take effect.

     

    Log4J to java.util.logging mappings

     

    When you change a Log4J priority level via jboss-log4j.xml, the corresponding java.util.logging Logger is also changed.  However, there is not a one-to-one mapping of priorities between Log4J and java.util.logging.  Here is how priority levels will be mapped:

    If I change the Log4J priority to

    the java.util.logging priority will be set to

    OFF

    OFF

    FATAL

    SEVERE

    ERROR

    SEVERE

    WARN

    WARNING

    INFO

    INFO

    DEBUG

    FINE

    TRACE

    FINEST

    ALL

    ALL

     

     

    java.util.logging to Log4J mappings

     

    Conversely, when JSF or Facelets logs a message using java.util.logging, the priority level must be mapped to a Log4J priority.  Here are those mappings:

    If the message is logged as

    it will be logged with this priority in Log4J

    OFF

    OFF

    SEVERE

    ERROR

    WARNING

    WARN

    INFO

    INFO

    CONFIG

    INFO

    FINE

    DEBUG

    FINER

    TRACE

    FINEST

    TRACE

    ALL

    ALL

     

     

    Referenced by: