Our web application currently uses Log4j and CXF 2.4.2, and has some
code to dynamically toggling inbound or outbound logging. This means
that while our web application is running, administrators can
temporarily enable inbound SOAP message logging, and then turn it back
off when they're done. The underlying code looks like this:
public void setInboundLogging(boolean b) {
LogFactory.getLog(LoggingInInterceptor.class).setLevel(b ? Level.INFO
: Level.ERROR);
}
public void setOutboundLogging(boolean b) {
LogFactory.getLog(LoggingOutInterceptor.class).setLevel(b ? Level.INFO
: Level.ERROR);
}
This worked in CXF 2.4.2, but breaks in CXF 2.5.3. This is because CXF
2.5.3 uses a more complex implementation of the logging interceptor
classes. Now, the LoggingInInterceptor and LoggingOutInterceptor classes
both use the
"org.apache.cxf.services.MyImplService.MyServiceImplPort.MyService"
logger, whereas before they both had separate loggers based on their
class name. Because the in and out interceptors share the same logger in
CXF 2.5.3, I can't think of a way to control them independently anymore.
I see two workarounds, one would be to implement our own in-house
logging interceptors which behave like the ones in CXF 2.4.2. Another
might be to create an in-house patch of CXF 2.5.3 which has an extra
"logName" on these interceptors...
<bean id="loggingInInterceptor"
class="org.apache.cxf.interceptor.LoggingInInterceptor">
<property name="logName"
value="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</bean>
Are there any other more intelligent ways to approach this problem?
Also, should I submit an improvement request to CXF's issue tracker
describing this use case?
Thanks,
- Aaron