Inconsistent use of logger delegation via LogUtils
--------------------------------------------------
Key: CXF-1981
URL: https://issues.apache.org/jira/browse/CXF-1981
Project: CXF
Issue Type: Bug
Affects Versions: 2.2
Reporter: Andrzej Michalec
Priority: Minor
Fix For: 2.2
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.busapplicationcont...@6c826c82: display name
[org.apache.cxf.bus.spring.busapplicationcont...@6c826c82]; startup date [Wed
Jan 14 14:09:05 CET 2009]; parent:
org.springframework.web.context.support.xmlwebapplicationcont...@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.busapplicationcont...@6c826c82]:
org.springframework.beans.factory.support.defaultlistablebeanfact...@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)) {
LOG.fine("Adding interceptor " + i + " to phase " + phaseName);
}
...
}
public synchronized boolean doIntercept(Message message) {
...
if (LOG.isLoggable(Level.FINE)) {
LogUtils.log(LOG, Level.FINE,
"Application has thrown exception,
unwinding now", ex);
} 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
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.