You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2008/10/28 13:30:06 UTC
svn commit: r708554 -
/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
Author: bimargulies
Date: Tue Oct 28 05:30:06 2008
New Revision: 708554
URL: http://svn.apache.org/viewvc?rev=708554&view=rev
Log:
Apply patch for CXF-1887. Thanks!
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=708554&r1=708553&r2=708554&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java Tue Oct 28 05:30:06 2008
@@ -77,6 +77,18 @@
newOut.registerCallback(new LoggingCallback(message, os));
}
}
+
+ /**
+ * Transform the string before display. The implementation in this class
+ * does nothing. Override this method if you want to change the contents of the
+ * logged message before it is delivered to the output.
+ * For example, you can use this to masking out sensitive information.
+ * @param originalLogString the raw log message.
+ * @return transformed data
+ */
+ protected String transform(String originalLogString) {
+ return originalLogString;
+ }
class LoggingCallback implements CachedOutputStreamCallback {
@@ -126,9 +138,9 @@
}
if (writer != null) {
- writer.println(buffer.toString());
+ writer.println(transform(buffer.toString()));
} else if (LOG.isLoggable(Level.INFO)) {
- LOG.info(buffer.toString());
+ LOG.info(transform(buffer.toString()));
}
try {
//empty out the cache
@@ -140,5 +152,6 @@
message.setContent(OutputStream.class,
origStream);
}
- }
+ }
+
}