You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2012/07/04 09:03:34 UTC

svn commit: r1357109 - in /cxf/branches/2.6.x-fixes: ./ api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java api/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java

Author: ffang
Date: Wed Jul  4 07:03:33 2012
New Revision: 1357109

URL: http://svn.apache.org/viewvc?rev=1357109&view=rev
Log:
Merged revisions 1357060 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1357060 | ffang | 2012-07-04 12:05:49 +0800 (δΈ‰, 04  7 2012) | 1 line
  
  [CXF-4392]Easier customization of log messages in Logging[In|Out]Interceptor
........

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
    cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=1357109&r1=1357108&r2=1357109&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Wed Jul  4 07:03:33 2012
@@ -24,7 +24,6 @@ import java.io.PrintWriter;
 import java.io.Reader;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.IOUtils;
@@ -32,6 +31,8 @@ import org.apache.cxf.io.CachedOutputStr
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 
+
+
 /**
  * A simple logging handler which outputs the bytes of the message to the
  * Logger.
@@ -172,7 +173,13 @@ public class LoggingInInterceptor extend
                 
             }
         }
-        log(logger, buffer.toString());
+        log(logger, formatLoggingMessage(buffer));
+    }
+
+
+    protected String formatLoggingMessage(LoggingMessage loggingMessage) {
+
+        return loggingMessage.toString();
     }
 
     @Override

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=1357109&r1=1357108&r2=1357109&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java Wed Jul  4 07:03:33 2012
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.interceptor;
 
+
 import java.io.FilterWriter;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -27,7 +28,6 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.io.CacheAndWriteOutputStream;
@@ -36,6 +36,7 @@ import org.apache.cxf.io.CachedOutputStr
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 
+
 /**
  * 
  */
@@ -181,7 +182,11 @@ public class LoggingOutInterceptor exten
             super.close();
         }
     }
-    
+
+    protected String formatLoggingMessage(LoggingMessage buffer) {
+        return buffer.toString();
+    }
+
     class LoggingCallback implements CachedOutputStreamCallback {
         
         private final Message message;
@@ -204,7 +209,7 @@ public class LoggingOutInterceptor exten
             String ct = (String)message.get(Message.CONTENT_TYPE);
             if (!isShowBinaryContent() && isBinaryContent(ct)) {
                 buffer.getMessage().append(BINARY_CONTENT_MESSAGE).append('\n');
-                log(logger, buffer.toString());
+                log(logger, formatLoggingMessage(buffer));
                 return;
             }
             
@@ -227,7 +232,7 @@ public class LoggingOutInterceptor exten
                 //ignore
             }
 
-            log(logger, buffer.toString());
+            log(logger, formatLoggingMessage(buffer));
             try {
                 //empty out the cache
                 cos.lockOutputStream();