Description
Even after installation of Log4jLogger delegate (via META-INF/cxf/org.apache.cxf.Logger file) some messages still are logged by java.util.logging – example:
14 Jan 2009 14:09:05,358 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO org.apache.cxf.bus.spring.BusApplicationContext - Refreshing org.apache.cxf.bus.spring.BusApplicationContext@6c826c82: display name [org.apache.cxf.bus.spring.BusApplicationContext@6c826c82]; startup date [Wed Jan 14 14:09:05 CET 2009]; parent: org.springframework.web.context.support.XmlWebApplicationContext@6abe6abe
14 Jan 2009 14:09:05,393 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO org.apache.cxf.bus.spring.BusApplicationContext - Bean factory for application context [org.apache.cxf.bus.spring.BusApplicationContext@6c826c82]: org.springframework.beans.factory.support.DefaultListableBeanFactory@75d275d2
...
Jan 14, 2009 2:10:03 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:148)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:114)
...
Review of PhaseInterceptorChain class shows that some log messages are passed via delegating logger and other via direct call to LogUtils:
public class PhaseInterceptorChain implements InterceptorChain {
private static final Logger LOG = LogUtils.getL7dLogger(PhaseInterceptorChain.class);
...
public void add(Interceptor i, boolean force) {
...
if (LOG.isLoggable(Level.FINE))
...
}
public synchronized boolean doIntercept(Message message) {
...
if (LOG.isLoggable(Level.FINE))
else if (LOG.isLoggable(Level.INFO))
{ ... }}
Workaround is to install SFL4J delegating JUL to Log4j however I guess it would be better clean up the code. I think that use of LogUtils.log() should be forbidden and enforcement could be done via checkstyle (marking this method as depreciaded first) or introduction of AOP with aspect checking calls to illegal method.
cheers,
andy