user3321467
user3321467

Reputation: 21

Enable logging in Apache CXF generated client

I followed directions on CXF web site to enable logging of SOAP requests, but cannot see any logging going on in my logs. I have log4j, so I added -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger to Tomcat jvm args, then I created cxf.xml and put into classpath. I also added logger into log4j config. Nothing gets logged. What can be a problem?

cxf.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:cxf="http://cxf.apache.org/core"
  xsi:schemaLocation="
  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<cxf:bus>
    <cxf:features>
        <cxf:logging/>
    </cxf:features>
</cxf:bus>
</beans>

Upvotes: 2

Views: 3081

Answers (1)

FrVaBe
FrVaBe

Reputation: 49341

I use the LoggingInInterceptor/LoggingOutInterceptor and am not sure about your bus configuration but you should be sure to also added a correct logger (with the correct name) to your log4j configuration.

In the Apache CXF - 2.5 Migration Guido you will find the usefull information

The Logging interceptors now log using service specific categories/loggers instead of just LoggingInInterceptor/LoggingOutInterceptor. The names of the logger that is used is org.apache.cxf.services.ServiceName.PortName.PortTypeName. This allows the user to configure specific per service filters and formatters in their logging configuration.

I have written a blog post about logging with Apache CXF that provides all information I needed to enable request/response logging in my application.

Upvotes: 1

Related Questions