diff options
author | Joakim Erdfelt | 2011-08-24 20:01:00 +0000 |
---|---|---|
committer | Joakim Erdfelt | 2011-08-24 20:01:00 +0000 |
commit | 3399242d831ca3730bec8877bf4599e65ccec3aa (patch) | |
tree | d463aa73342a8ff4a655edff6a802ce9b0d609ee /jetty-jndi/src | |
parent | f7f7e0af7545e060f6508c7fe07b858fd58ebc3b (diff) | |
download | org.eclipse.jetty.project-3399242d831ca3730bec8877bf4599e65ccec3aa.tar.gz org.eclipse.jetty.project-3399242d831ca3730bec8877bf4599e65ccec3aa.tar.xz org.eclipse.jetty.project-3399242d831ca3730bec8877bf4599e65ccec3aa.zip |
293739 - Deprecate static Jetty Log usage in favor of named logs
+ Finished conversion of jetty-ajp, jetty-client, jetty-deploy,
jetty-jaspi, jetty-jndi, jetty-plus, jetty-webapp
Diffstat (limited to 'jetty-jndi/src')
3 files changed, 36 insertions, 36 deletions
diff --git a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/DataSourceCloser.java b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/DataSourceCloser.java index 4c3db97973..352b745fcc 100644 --- a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/DataSourceCloser.java +++ b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/DataSourceCloser.java @@ -8,6 +8,7 @@ import javax.sql.DataSource; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.Destroyable; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** * Close a DataSource. @@ -18,6 +19,8 @@ import org.eclipse.jetty.util.log.Log; */ public class DataSourceCloser implements Destroyable { + private static final Logger LOG = Log.getLogger(DataSourceCloser.class); + final DataSource _datasource; final String _shutdown; @@ -43,7 +46,7 @@ public class DataSourceCloser implements Destroyable { if (_shutdown!=null) { - Log.info("Shutdown datasource {}",_datasource); + LOG.info("Shutdown datasource {}",_datasource); Statement stmt = _datasource.getConnection().createStatement(); stmt.executeUpdate(_shutdown); stmt.close(); @@ -51,18 +54,18 @@ public class DataSourceCloser implements Destroyable } catch (Exception e) { - Log.warn(e); + LOG.warn(e); } try { Method close = _datasource.getClass().getMethod("close", new Class[]{}); - Log.info("Close datasource {}",_datasource); + LOG.info("Close datasource {}",_datasource); close.invoke(_datasource, new Object[]{}); } catch (Exception e) { - Log.warn(e); + LOG.warn(e); } } } diff --git a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaURLContextFactory.java b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaURLContextFactory.java index 59e7aceb9c..efa6367fed 100644 --- a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaURLContextFactory.java +++ b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/java/javaURLContextFactory.java @@ -21,6 +21,7 @@ import javax.naming.NamingException; import javax.naming.spi.ObjectFactory; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** javaURLContextFactory @@ -32,16 +33,9 @@ import org.eclipse.jetty.util.log.Log; * <p><h4>Usage</h4> * <pre> */ -/* -* </pre> -* -* @see -* -* -* @version 1.0 -*/ public class javaURLContextFactory implements ObjectFactory { + private static final Logger LOG = Log.getLogger(javaURLContextFactory.class); /** * Either return a new context or the resolution of a url. @@ -59,14 +53,14 @@ public class javaURLContextFactory implements ObjectFactory // null object means return a root context for doing resolutions if (url == null) { - if(Log.isDebugEnabled())Log.debug(">>> new root context requested "); + if(LOG.isDebugEnabled())LOG.debug(">>> new root context requested "); return new javaRootURLContext(env); } // return the resolution of the url if (url instanceof String) { - if(Log.isDebugEnabled())Log.debug(">>> resolution of url "+url+" requested"); + if(LOG.isDebugEnabled())LOG.debug(">>> resolution of url "+url+" requested"); Context rootctx = new javaRootURLContext (env); return rootctx.lookup ((String)url); } @@ -74,7 +68,7 @@ public class javaURLContextFactory implements ObjectFactory // return the resolution of at least one of the urls if (url instanceof String[]) { - if(Log.isDebugEnabled())Log.debug(">>> resolution of array of urls requested"); + if(LOG.isDebugEnabled())LOG.debug(">>> resolution of array of urls requested"); String[] urls = (String[])url; Context rootctx = new javaRootURLContext (env); Object object = null; @@ -97,7 +91,7 @@ public class javaURLContextFactory implements ObjectFactory return object; } - if(Log.isDebugEnabled())Log.debug(">>> No idea what to do, so return a new root context anyway"); + if(LOG.isDebugEnabled())LOG.debug(">>> No idea what to do, so return a new root context anyway"); return new javaRootURLContext (env); } }; diff --git a/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java b/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java index 14ce8e8fe3..eaea6c40a3 100644 --- a/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java +++ b/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java @@ -36,6 +36,7 @@ import org.eclipse.jetty.jndi.NamingContext; import org.eclipse.jetty.jndi.NamingUtil; import org.eclipse.jetty.jndi.local.localContextRoot; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -47,6 +48,8 @@ import static org.junit.Assert.fail; */ public class TestJNDI { + private static final Logger LOG = Log.getLogger(TestJNDI.class); + static { // NamingUtil.__log.setDebugEnabled(true); @@ -115,48 +118,48 @@ public class TestJNDI InitialContext initCtx = new InitialContext(); Context sub0 = (Context)initCtx.lookup("java:"); - if(Log.isDebugEnabled())Log.debug("------ Looked up java: --------------"); + if(LOG.isDebugEnabled())LOG.debug("------ Looked up java: --------------"); Name n = sub0.getNameParser("").parse("/red/green/"); - if(Log.isDebugEnabled())Log.debug("get(0)="+n.get(0)); - if(Log.isDebugEnabled())Log.debug("getPrefix(1)="+n.getPrefix(1)); + if(LOG.isDebugEnabled())LOG.debug("get(0)="+n.get(0)); + if(LOG.isDebugEnabled())LOG.debug("getPrefix(1)="+n.getPrefix(1)); n = n.getSuffix(1); - if(Log.isDebugEnabled())Log.debug("getSuffix(1)="+n); - if(Log.isDebugEnabled())Log.debug("get(0)="+n.get(0)); - if(Log.isDebugEnabled())Log.debug("getPrefix(1)="+n.getPrefix(1)); + if(LOG.isDebugEnabled())LOG.debug("getSuffix(1)="+n); + if(LOG.isDebugEnabled())LOG.debug("get(0)="+n.get(0)); + if(LOG.isDebugEnabled())LOG.debug("getPrefix(1)="+n.getPrefix(1)); n = n.getSuffix(1); - if(Log.isDebugEnabled())Log.debug("getSuffix(1)="+n); - if(Log.isDebugEnabled())Log.debug("get(0)="+n.get(0)); - if(Log.isDebugEnabled())Log.debug("getPrefix(1)="+n.getPrefix(1)); + if(LOG.isDebugEnabled())LOG.debug("getSuffix(1)="+n); + if(LOG.isDebugEnabled())LOG.debug("get(0)="+n.get(0)); + if(LOG.isDebugEnabled())LOG.debug("getPrefix(1)="+n.getPrefix(1)); n = n.getSuffix(1); - if(Log.isDebugEnabled())Log.debug("getSuffix(1)="+n); + if(LOG.isDebugEnabled())LOG.debug("getSuffix(1)="+n); n = sub0.getNameParser("").parse("pink/purple/"); - if(Log.isDebugEnabled())Log.debug("get(0)="+n.get(0)); - if(Log.isDebugEnabled())Log.debug("getPrefix(1)="+n.getPrefix(1)); + if(LOG.isDebugEnabled())LOG.debug("get(0)="+n.get(0)); + if(LOG.isDebugEnabled())LOG.debug("getPrefix(1)="+n.getPrefix(1)); n = n.getSuffix(1); - if(Log.isDebugEnabled())Log.debug("getSuffix(1)="+n); - if(Log.isDebugEnabled())Log.debug("get(0)="+n.get(0)); - if(Log.isDebugEnabled())Log.debug("getPrefix(1)="+n.getPrefix(1)); + if(LOG.isDebugEnabled())LOG.debug("getSuffix(1)="+n); + if(LOG.isDebugEnabled())LOG.debug("get(0)="+n.get(0)); + if(LOG.isDebugEnabled())LOG.debug("getPrefix(1)="+n.getPrefix(1)); NamingContext ncontext = (NamingContext)sub0; Name nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse("/yellow/blue/")); - Log.debug(nn.toString()); + LOG.debug(nn.toString()); assertEquals (2, nn.size()); nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse("/yellow/blue")); - Log.debug(nn.toString()); + LOG.debug(nn.toString()); assertEquals (2, nn.size()); nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse("/")); - if(Log.isDebugEnabled())Log.debug("/ parses as: "+nn+" with size="+nn.size()); - Log.debug(nn.toString()); + if(LOG.isDebugEnabled())LOG.debug("/ parses as: "+nn+" with size="+nn.size()); + LOG.debug(nn.toString()); assertEquals (1, nn.size()); nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse("")); - Log.debug(nn.toString()); + LOG.debug(nn.toString()); assertEquals (0, nn.size()); Context fee = ncontext.createSubcontext("fee"); |