You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/11/30 21:12:38 UTC

svn commit: r599943 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java

Author: dkulp
Date: Fri Nov 30 12:12:37 2007
New Revision: 599943

URL: http://svn.apache.org/viewvc?rev=599943&view=rev
Log:
Merged revisions 596558-596564,596566-596577,596579-596950,596952-596981,596983-596984 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r596558 | mmao | 2007-11-20 02:33:00 -0500 (Tue, 20 Nov 2007) | 4 lines
  
  * Add the printWriter into the logging in/out interceptors, if it's not null, log to the writer passed in
  * Re-Enable the tests
........
  r596984 | mmao | 2007-11-21 03:35:11 -0500 (Wed, 21 Nov 2007) | 3 lines
  
  * Fix the tests, using auto flush
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-blocked' - no diff available.

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=599943&r1=599942&r2=599943&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Fri Nov 30 12:12:37 2007
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PrintWriter;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -39,20 +40,21 @@
     private static final Logger LOG = LogUtils.getL7dLogger(LoggingInInterceptor.class);
 
     private int limit = 100 * 1024;
-    private boolean enabled;
+    private PrintWriter writer;
     
     
     public LoggingInInterceptor() {
         super(Phase.RECEIVE);
     }
+
     public LoggingInInterceptor(int lim) {
         this();
         limit = lim;
     }
 
-    public LoggingInInterceptor(boolean b) {
+    public LoggingInInterceptor(PrintWriter w) {
         this();
-        this.enabled = b;
+        this.writer = w;
     }
     
     public void setLimit(int lim) {
@@ -64,7 +66,7 @@
     }    
 
     public void handleMessage(Message message) throws Fault {
-        if (enabled || LOG.isLoggable(Level.INFO)) {
+        if (writer != null || LOG.isLoggable(Level.INFO)) {
             logging(message);
         }
     }
@@ -112,7 +114,9 @@
             }
         }
 
-        if (LOG.isLoggable(Level.INFO)) {
+        if (writer != null) {
+            writer.println(buffer.toString());
+        } else if (LOG.isLoggable(Level.INFO)) {
             LOG.info(buffer.toString());
         }
     }

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=599943&r1=599942&r2=599943&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java Fri Nov 30 12:12:37 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.interceptor;
 
 import java.io.OutputStream;
+import java.io.PrintWriter;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -39,7 +40,7 @@
     private static final Logger LOG = LogUtils.getL7dLogger(LoggingOutInterceptor.class); 
 
     private int limit = 100 * 1024;
-    private boolean enabled;
+    private PrintWriter writer;
     
     public LoggingOutInterceptor() {
         super(Phase.PRE_STREAM);
@@ -50,9 +51,9 @@
         limit = lim;
     }
 
-    public LoggingOutInterceptor(boolean b) {
+    public LoggingOutInterceptor(PrintWriter w) {
         this();
-        this.enabled = b;
+        this.writer = w;
     }
     
     public void setLimit(int lim) {
@@ -69,7 +70,7 @@
             return;
         }
 
-        if (LOG.isLoggable(Level.INFO) || enabled) {
+        if (LOG.isLoggable(Level.INFO) || writer != null) {
             // Write the output while caching it for the log message
             final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(os);
             message.setContent(OutputStream.class, newOut);
@@ -104,7 +105,9 @@
                 //ignore
             }
 
-            if (LOG.isLoggable(Level.INFO)) {
+            if (writer != null) {
+                writer.println(buffer.toString());
+            } else if (LOG.isLoggable(Level.INFO)) {
                 LOG.info(buffer.toString());
             }
         }