Refactor log messages to use logger from concrete class
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Sep 2010 21:07:37 +0000 (21:07 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Sep 2010 21:07:37 +0000 (21:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@995576 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/AbstractEndpoint.java
java/org/apache/tomcat/util/net/AprEndpoint.java
java/org/apache/tomcat/util/net/JIoEndpoint.java
java/org/apache/tomcat/util/net/NioEndpoint.java

index 43116e4..fe167fc 100644 (file)
@@ -42,7 +42,6 @@ import org.apache.tomcat.util.threads.ThreadPoolExecutor;
  * @author Remy Maucherat
  */
 public abstract class AbstractEndpoint {
-    private static final Log log = LogFactory.getLog(AbstractEndpoint.class);
     
     // -------------------------------------------------------------- Constants
     protected static final StringManager sm = StringManager.getManager("org.apache.tomcat.util.net.res");
@@ -318,7 +317,7 @@ public abstract class AbstractEndpoint {
                 return IntrospectionUtils.setProperty(this,name,value,false);
             }
         }catch ( Exception x ) {
-            log.error("Unable to set attribute \""+name+"\" to \""+value+"\"",x);
+            getLog().error("Unable to set attribute \""+name+"\" to \""+value+"\"",x);
             return false;
         }
     }
@@ -408,16 +407,16 @@ public abstract class AbstractEndpoint {
             s.setSoTimeout(getSocketProperties().getSoTimeout());
             // TODO Consider hard-coding to s.setSoLinger(true,0)
             s.setSoLinger(getSocketProperties().getSoLingerOn(),getSocketProperties().getSoLingerTime());
-            if (log.isDebugEnabled()) {
-                log.debug("About to unlock socket for:"+saddr);
+            if (getLog().isDebugEnabled()) {
+                getLog().debug("About to unlock socket for:"+saddr);
             }
             s.connect(saddr,getSocketProperties().getUnlockTimeout());
-            if (log.isDebugEnabled()) {
-                log.debug("Socket unlock completed for:"+saddr);
+            if (getLog().isDebugEnabled()) {
+                getLog().debug("Socket unlock completed for:"+saddr);
             }
         } catch(Exception e) {
-            if (log.isDebugEnabled()) {
-                log.debug(sm.getString("endpoint.debug.unlock", "" + getPort()), e);
+            if (getLog().isDebugEnabled()) {
+                getLog().debug(sm.getString("endpoint.debug.unlock", "" + getPort()), e);
             }
         } finally {
             if (s != null) {
@@ -470,7 +469,7 @@ public abstract class AbstractEndpoint {
             f = new File(path);
         }
         if (!f.exists()) {
-            log.warn("configured file:["+path+"] does not exist.");
+            getLog().warn("configured file:["+path+"] does not exist.");
         }
         return path;
     }
@@ -480,6 +479,8 @@ public abstract class AbstractEndpoint {
         return val;
     }
     
+    protected abstract Log getLog();
+
     // --------------------  SSL related properties --------------------
 
     private String algorithm = KeyManagerFactory.getDefaultAlgorithm();
index 29232ba..3b278d1 100644 (file)
@@ -887,6 +887,11 @@ public class AprEndpoint extends AbstractEndpoint {
         }
     }
 
+    @Override
+    protected Log getLog() {
+        return log;
+    }
+
     // --------------------------------------------------- Acceptor Inner Class
 
 
index 0853ffb..9aade5c 100644 (file)
@@ -538,6 +538,11 @@ public class JIoEndpoint extends AbstractEndpoint {
     protected ConcurrentLinkedQueue<SocketWrapper<Socket>> waitingRequests =
         new ConcurrentLinkedQueue<SocketWrapper<Socket>>();
 
+    @Override
+    protected Log getLog() {
+        return log;
+    }
+
     private static class PrivilegedSetTccl implements PrivilegedAction<Void> {
 
         private ClassLoader cl;
index d5cadd7..4004c3d 100644 (file)
@@ -747,6 +747,10 @@ public class NioEndpoint extends AbstractEndpoint {
         return true;
     }
 
+    @Override
+    protected Log getLog() {
+        return log;
+    }
 
     // --------------------------------------------------- Acceptor Inner Class