You can extend LoggingInInterceptor
and LoggingOutInterceptor
. Based on the soapAction
you can ignore only logging for one service.
Extend LoggingOutInterceptor
for all the outbound requests and override method handleMessage
like this.
private boolean doNotLog=false;
public void handleMessage(Message message) throws Fault {
TreeMap<String,List> protocolHeaders =
(TreeMap<String, List>) message.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS");
if (protocolHeaders != null) {
List value = protocolHeaders.get("SOAPAction");
String soapAction = value != null ? (String)value.get(0) : "";
if (soapAction.equalIgnoreCase(YOUR_SERVICE_SOAP_ACTION)) {
doNotLog=true;
}
}
super.handleMessage(message);
}
Now there is one more method you have to override in the same class.
@Override
protected String transform(String originalLogString) {
if (doNotLog) {
return null;
}
return originalLogString;
}
For all inbound responses, extend LoggingInInterceptor
and only override transform method. You can just check the responseType from the originalLogString and ignore it.