cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r708554 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
Date Tue, 28 Oct 2008 12:30:06 GMT
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);
         }
-    } 
+    }
+
 }



Mime
View raw message