How to ignore base64binary fields when logging SOAP messages?
I am using Spring's SoapEnvelopeLoggingInterceptor
to log SOAP requests/responses.
Some of the requests/responses contains base64Binary
f开发者_如何学编程ields which takes up a lot of space in the log files and I don't require to log it for my purposes.
Digging into the code of SoapEnvelopeLoggingInterceptor
I can see the java.xml.transform.Transformer
used is created like this:
Transformer transformer = createTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "no");
return transformer;
Are there some properties I can set on the Transformer
which will prevent it from printing out the contents of the base64Binary
fields? Or anything else I can configure or override to prevent it from being logged?
I do not know about Transformer, however I would think that a Base64 field will have roughly equal numbers of uppercase and lowercase letters. Normal text will tend to have either many more lowercase or be all uppercase. You may be able to determine the difference that way.
Also there are punctuation characters that never appear in Base64. Seeing any one of those will tell you that the field is not Base64.
精彩评论