I have an interesting problem. I have a client program that can connect to
multiple servers and I don't know where these servers are located in advance.
Thus, I am using JaxWsProxyFactoryBean to create my cxf clients. No problems so
far. Now I would like to add logging, so I add a little piece of code that
looks like this:
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
Log cxfInLogger =
LogFactory.getLog("org.apache.cxf.interceptor.LoggingInInterceptor");
Log cxfOutLogger =
LogFactory.getLog("org.apache.cxf.interceptor.LoggingOutInterceptor");
if (cxfInLogger.isInfoEnabled()) {
logger.info("Adding Logging In Interceptor.");
factory.getInInterceptors().add(new LoggingInInterceptor());
}
if (cxfOutLogger.isInfoEnabled()) {
logger.info("Adding Logging Out Interceptor.");
factory.getOutInterceptors().add(new LoggingOutInterceptor());
}
I have Log4j logging setup and it is set to configureAndWatch my properties
file. I have the following in my log4j.properties file:
log4j.logger.org.apache.cxf=WARN
log4j.logger.org.apache.cxf.interceptor.LoggingInInterceptor=INFO
log4j.logger.org.apache.cxf.interceptor.LoggingOutInterceptor=INFO
Now, I start up my client, and I see my "Adding Logging In Interceptor" and
"Adding Logging Out Interceptor" messages, but I don't see any of the soap
messages. But if I change log4j.logger.org.apache.cxf to INFO *while the client
is running* then I will suddenly get a bunch of soap messages and soap messages
will continue to be logged. But, if I change log4j.logger.org.apache.cxf to
INFO before I start my client, I don't get any soap messages.
It seems like making some change to the log4j properties file and causing it to
be reloaded gives cxf a kick in the pants and it starts working. Has anyone
ever experienced this or have any ideas of how I could troubleshoot this
problem?
Thank you,
John