Is it possible to log the request/response as XML using CXF, ideally to a separate file so I can monitor what an application is doing?
So, I tried a little more with this. To get the XML Request and Replies logged, and if you are using Log4J, you need to set the Log-level of CXF in the log4j.xml file like this (>= INFO):
<logger name="org.apache.cxf" >
<level value="INFO" />
</logger>
And the cxf.xml file should contains this:
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
Both files should be in the CLASSPATH.
To display the soap message add this to your code:
Client client = ClientProxy.getClient(service);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());