From: markt Date: Thu, 9 Sep 2010 21:07:37 +0000 (+0000) Subject: Refactor log messages to use logger from concrete class X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=366adc422132363dcbf690191ce30d5af34e909a;p=tomcat7.0 Refactor log messages to use logger from concrete class git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@995576 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index 43116e46c..fe167fcc8 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -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(); diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 29232ba6c..3b278d13f 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -887,6 +887,11 @@ public class AprEndpoint extends AbstractEndpoint { } } + @Override + protected Log getLog() { + return log; + } + // --------------------------------------------------- Acceptor Inner Class diff --git a/java/org/apache/tomcat/util/net/JIoEndpoint.java b/java/org/apache/tomcat/util/net/JIoEndpoint.java index 0853ffb6b..9aade5cba 100644 --- a/java/org/apache/tomcat/util/net/JIoEndpoint.java +++ b/java/org/apache/tomcat/util/net/JIoEndpoint.java @@ -538,6 +538,11 @@ public class JIoEndpoint extends AbstractEndpoint { protected ConcurrentLinkedQueue> waitingRequests = new ConcurrentLinkedQueue>(); + @Override + protected Log getLog() { + return log; + } + private static class PrivilegedSetTccl implements PrivilegedAction { private ClassLoader cl; diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index d5cadd7a1..4004c3d43 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -747,6 +747,10 @@ public class NioEndpoint extends AbstractEndpoint { return true; } + @Override + protected Log getLog() { + return log; + } // --------------------------------------------------- Acceptor Inner Class