开发者

How to forward JSF RI (Mojarra) log to slf4j or log4j?

开发者 https://www.devze.com 2023-02-14 02:21 出处:网络
How to teach Mojarra to use slf4j or log4j? According to slf4j documentation I have to call: org.slf4j.bridge.SLF4JBridgeHandler.开发者_开发技巧install();

How to teach Mojarra to use slf4j or log4j?

According to slf4j documentation I have to call:

org.slf4j.bridge.SLF4JBridgeHandler.开发者_开发技巧install();

Somewhere in my project. But I can't call it in Mojarra... So, the question is when and how shall I execute this install() method?


The best way to do it is through a custom Listener. Being initialized before JSF servlet it should configure jul-to-slf4j bridge in contextInitialized(ServletContextEvent).


I believe Mojarra, being Sun code, uses java.util.logging.

The slf4j project download contains a drop-in module which forwards all j.u.l statements to slf4j. You can then use log4j as the slf4j backend.

0

精彩评论

暂无评论...
验证码 换一张
取 消