JSF2 logs with tomcat

后端 未结 1 1773
清歌不尽
清歌不尽 2020-12-08 16:44

I\'m having a project using JSF2 (2.1.2), Richfaces4 (4.0.0.Final) on tomcat6 (6.0.28). In order to manage portability between Tomcat and WebSphere7 for my EARs, I have the

相关标签:
1条回答
  • 2020-12-08 17:34

    Two facts:

    • JSF uses java.util.logging API which is to be configured by a logging.properties file in the root of the runtime classpath.
    • The logging.properties file of the currently(!) running runtime environment (JRE) will be used.

    If you're running Tomcat from inside an IDE like Eclipse, then Tomcat's own logging.properties won't be used. The one in JDK/JRE/lib will be used where "JDK" is the JDK install folder such as jdk1.6.0_23. If you'd like to explicitly specify the location of the logging.properties file, then you would need to set a VM argument:

    -Djava.util.logging.config.file=/path/to/tomcat/logging.properties 
    

    Regardless of the logging file used, in order to enable Mojarra logging, you need to open the logging.properties template file in question, scroll to the bottom and edit the following line near the bottom

    java.util.logging.ConsoleHandler.level = INFO
    

    into

    java.util.logging.ConsoleHandler.level = ALL
    

    so that the global console level is set to ALL instead of INFO. Otherwise lower levels than INFO just won't be logged at all.

    Finally add the following two lines to the very bottom of the file

    javax.faces.level = ALL
    com.sun.faces.level = ALL
    javax.enterprise.resource.webcontainer.jsf.level = ALL
    

    The first turns on all JSF API logging, the second turns on all JSF impl (Mojarra) logging, and the third turns on all JSF Java EE logging.

    0 讨论(0)
提交回复
热议问题