cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1070778 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor: AbstractLoggingInterceptor.java LoggingInInterceptor.java LoggingOutInterceptor.java
Date Tue, 15 Feb 2011 05:10:54 GMT
Author: ningjiang
Date: Tue Feb 15 05:10:53 2011
New Revision: 1070778

URL: http://svn.apache.org/viewvc?rev=1070778&view=rev
Log:
CXF-3314 Separate loggers for LoggingInInterceptor and LoggingOutInterceptor

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
    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/AbstractLoggingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java?rev=1070778&r1=1070777&r2=1070778&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
Tue Feb 15 05:10:53 2011
@@ -31,7 +31,6 @@ import javax.xml.transform.Transformer;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.io.CachedOutputStream;
@@ -44,19 +43,18 @@ import org.apache.cxf.phase.AbstractPhas
  */
 public abstract class AbstractLoggingInterceptor extends AbstractPhaseInterceptor<Message>
{
 
-    protected static final Logger LOG = LogUtils.getL7dLogger(AbstractLoggingInterceptor.class);
-
     protected int limit = 100 * 1024;
     protected PrintWriter writer;
     protected boolean prettyLogging;
     
-    
     public AbstractLoggingInterceptor(String phase) {
         super(phase);
     }
     public AbstractLoggingInterceptor(String id, String phase) {
         super(id, phase);
     }
+    
+    protected abstract Logger getLogger();
 
     public void setOutputLocation(String s) {
         if (s == null || "<logger>".equals(s)) {
@@ -71,7 +69,7 @@ public abstract class AbstractLoggingInt
                 File file = new File(uri);
                 writer = new PrintWriter(new FileWriter(file, true), true);
             } catch (Exception ex) {
-                LOG.log(Level.WARNING, "Error configuring log location " + s, ex);
+                getLogger().log(Level.WARNING, "Error configuring log location " + s, ex);
             }
         }
     }
@@ -147,8 +145,8 @@ public abstract class AbstractLoggingInt
         message = transform(message);
         if (writer != null) {
             writer.println(message);
-        } else if (LOG.isLoggable(Level.INFO)) {
-            LOG.info(message);
+        } else if (getLogger().isLoggable(Level.INFO)) {
+            getLogger().info(message);
         }
     }
     

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=1070778&r1=1070777&r2=1070778&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Tue
Feb 15 05:10:53 2011
@@ -21,8 +21,10 @@ package org.apache.cxf.interceptor;
 import java.io.InputStream;
 import java.io.PrintWriter;
 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;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
@@ -34,7 +36,7 @@ import org.apache.cxf.phase.Phase;
  */
 @NoJSR250Annotations
 public class LoggingInInterceptor extends AbstractLoggingInterceptor {
-
+    private static final Logger LOG = LogUtils.getLogger(LoggingInInterceptor.class);
     
     public LoggingInInterceptor() {
         super(Phase.RECEIVE);
@@ -67,7 +69,7 @@ public class LoggingInInterceptor extend
     }
     
     public void handleMessage(Message message) throws Fault {
-        if (writer != null || LOG.isLoggable(Level.INFO)) {
+        if (writer != null || getLogger().isLoggable(Level.INFO)) {
             logging(message);
         }
     }
@@ -140,4 +142,9 @@ public class LoggingInInterceptor extend
         }
         log(buffer.toString());
     }
+
+    @Override
+    protected Logger getLogger() {
+        return LOG;
+    }
 }

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=1070778&r1=1070777&r2=1070778&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 Feb 15 05:10:53 2011
@@ -22,8 +22,10 @@ package org.apache.cxf.interceptor;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 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;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.io.CachedOutputStreamCallback;
@@ -35,6 +37,7 @@ import org.apache.cxf.phase.Phase;
  */
 @NoJSR250Annotations
 public class LoggingOutInterceptor extends AbstractLoggingInterceptor {
+    private static final Logger LOG = LogUtils.getLogger(LoggingOutInterceptor.class);
     private static final String LOG_SETUP = LoggingOutInterceptor.class.getName() + ".log-setup";
     
     public LoggingOutInterceptor(String phase) {
@@ -60,7 +63,7 @@ public class LoggingOutInterceptor exten
         if (os == null) {
             return;
         }
-        if (LOG.isLoggable(Level.INFO) || writer != null) {
+        if (getLogger().isLoggable(Level.INFO) || writer != null) {
             // Write the output while caching it for the log message
             boolean hasLogged = message.containsKey(LOG_SETUP);
             if (!hasLogged) {
@@ -154,4 +157,10 @@ public class LoggingOutInterceptor exten
         }
     }
 
+    @Override
+    protected Logger getLogger() {
+        return LOG;
+        
+    }
+
 }



Mime
View raw message