protected void writePayload(StringBuilder builder,
StringWriter stringWriter,
String contentType)
throws Exception {
// Just transform the XML message when the cos has content
if (isPrettyLogging()
&& contentType != null
&& contentType.indexOf("xml") >= 0
&& stringWriter.getBuffer().length() > 0) {
StringWriter swriter = new StringWriter();
XMLStreamWriter xwriter = StaxUtils.createXMLStreamWriter(swriter);
xwriter = new PrettyPrintXMLStreamWriter(xwriter, 2);
StaxUtils.copy(new StreamSource(new StringReader(stringWriter.getBuffer().toString())), xwriter);
xwriter.close();
String result = swriter.toString();
if (result.length() < limit || limit == -1) {
builder.append(swriter.toString());
} else {
builder.append(swriter.toString().substring(0, limit));
}
===========以上代码来源于
org.apache.cxf.interceptor.AbstractLoggingInterceptor。
显示如果result.length超过limit则截断。所以重写该方法即可。未验证。。。