I'm working on a JSF-Project with Primefaces on Websphere Application Server. Since Primefaces uses java.util.logging, I'm using the jul-to-slf4j Bridge to capture the Primefacs Logs into my Log4J Logfile.
But using the jul-to-slf4j Bridge, all java.util.logging Messages will be in my Logfile, including general Websphere Messages like "Application started" or "Server started".
Can the jul-to-slf4j be configured, so it only redirects specific Messages (e.g. everything from org.primefaces
) to SLF4j and leave the rest as it is?
I found a solution using
java.util.logging.Filter
, the filter just checks, if the name of the logger starts withorg.primefaces
:For this Solution, one has to set the SLF4JBridgeHandler and the Filter programmatically, setting it with the logging.properties file wont work.
Also, one hast to create the SLF4JBridgeHandler himself, due what is afaik a Bug, the SLF4JBridgeHandler dosn't respect the Filter out of the box.
Do not call
SLF4JBridgeHandler.removeHandlersForRootLogger()
since that will remove every other Handler that was set by Websphere!