From f6d45d5650acb392b1bef523fd312bf461e805ee Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 24 Aug 2011 13:14:28 -0700 Subject: [PATCH] 293739 - Deprecate static Jetty Log usage in favor of named logs + Finished conversion of the rest of jetty 7.x --- .../eclipse/jetty/embedded/FileServer.java | 5 +++- .../jetty/annotations/AnnotationParser.java | 11 +++++---- .../annotations/ClassInheritanceHandler.java | 5 +++- .../ResourceAnnotationHandler.java | 21 +++++++++-------- .../ResourcesAnnotationHandler.java | 9 +++++--- .../annotations/RunAsAnnotationHandler.java | 9 +++++--- .../eclipse/jetty/monitor/ThreadMonitor.java | 9 +++++--- .../eclipse/jetty/nested/NestedGenerator.java | 17 ++++++++------ .../nosql/mongodb/MongoSessionManager.java | 11 +++++---- .../boot/jsp/TagLibOSGiConfiguration.java | 5 +++- .../jetty/osgi/boot/OSGiAppProvider.java | 23 ++++++++++++------- .../DefaultJettyAtJettyHomeHelper.java | 13 +++++++---- .../webapp/WebBundleTrackerCustomizer.java | 7 ++++-- .../WebEquinoxToolsActivator.java | 7 ++++-- .../EquinoxConsoleWebSocketServlet.java | 15 +++++++----- .../java/org/eclipse/jetty/nested/Dump.java | 5 +++- .../org/eclipse/jetty/policy/JettyPolicy.java | 9 +++++--- .../jetty/rewrite/handler/RuleContainer.java | 11 +++++---- .../org/eclipse/jetty/util/UrlEncoded.java | 6 +++-- .../java/org/eclipse/jetty/nested/Dump.java | 5 +++- .../main/java/com/acme/DispatchServlet.java | 5 +++- .../src/main/java/com/acme/Dump.java | 5 +++- .../main/java/com/acme/SecureModeServlet.java | 5 +++- .../src/main/java/com/acme/TestFilter.java | 5 +++- .../java/com/acme/WebSocketChatServlet.java | 13 +++++++---- .../java/org/eclipse/jetty/TestServer.java | 5 +++- .../test/support/rawhttp/HttpsSocketImpl.java | 5 +++- 27 files changed, 165 insertions(+), 81 deletions(-) diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/FileServer.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/FileServer.java index 8410801fff9..b4f53ae1db3 100644 --- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/FileServer.java +++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/FileServer.java @@ -19,6 +19,7 @@ import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ /** Simple Jetty FileServer. @@ -33,6 +34,8 @@ import org.eclipse.jetty.util.log.Log; */ public class FileServer { + private static final Logger LOG = Log.getLogger(FileServer.class); + public static void main(String[] args) throws Exception { Server server = new Server(args.length == 0?8080:Integer.parseInt(args[0])); @@ -42,7 +45,7 @@ public class FileServer resource_handler.setWelcomeFiles(new String[]{ "index.html" }); resource_handler.setResourceBase(args.length == 2?args[1]:"."); - Log.info("serving " + resource_handler.getBaseResource()); + LOG.info("serving " + resource_handler.getBaseResource()); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() }); diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java index c8bfb168ab9..84a8c00954a 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java @@ -28,6 +28,7 @@ import java.util.jar.JarEntry; import org.eclipse.jetty.util.Loader; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.webapp.JarScanner; import org.objectweb.asm.AnnotationVisitor; @@ -43,7 +44,9 @@ import org.objectweb.asm.commons.EmptyVisitor; * a handler being able to be registered to handle each annotation type. */ public class AnnotationParser -{ +{ + private static final Logger LOG = Log.getLogger(AnnotationParser.class); + protected List _parsedClassNames = new ArrayList(); protected Map> _annotationHandlers = new HashMap>(); protected List _classHandlers = new ArrayList(); @@ -528,7 +531,7 @@ public class AnnotationParser } catch (Exception ex) { - Log.warn(Log.EXCEPTION,ex); + LOG.warn(Log.EXCEPTION,ex); } } } @@ -574,7 +577,7 @@ public class AnnotationParser } catch (Exception e) { - Log.warn("Problem processing jar entry "+entry, e); + LOG.warn("Problem processing jar entry "+entry, e); } } @@ -619,7 +622,7 @@ public class AnnotationParser } catch (Exception e) { - Log.warn("Problem processing jar entry "+entry, e); + LOG.warn("Problem processing jar entry "+entry, e); } } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java index 909a752c810..3207ce8189c 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java @@ -18,6 +18,7 @@ import java.util.List; import org.eclipse.jetty.annotations.AnnotationParser.ClassHandler; import org.eclipse.jetty.util.MultiMap; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** * ClassInheritanceHandler @@ -26,6 +27,8 @@ import org.eclipse.jetty.util.log.Log; */ public class ClassInheritanceHandler implements ClassHandler { + private static final Logger LOG = Log.getLogger(ClassInheritanceHandler.class); + MultiMap _inheritanceMap = new MultiMap(); @@ -47,7 +50,7 @@ public class ClassInheritanceHandler implements ClassHandler } catch (Exception e) { - Log.warn(e); + LOG.warn(e); } } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java index 8cdc128530d..88209f3bd7e 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java @@ -26,11 +26,14 @@ import org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectab import org.eclipse.jetty.plus.annotation.Injection; import org.eclipse.jetty.plus.annotation.InjectionCollection; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.webapp.MetaData; import org.eclipse.jetty.webapp.WebAppContext; public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationHandler { + private static final Logger LOG = Log.getLogger(ResourceAnnotationHandler.class); + protected WebAppContext _context; @@ -84,7 +87,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH } catch (NamingException e) { - Log.warn(e); + LOG.warn(e); } } } @@ -97,14 +100,14 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH //JavaEE Spec 5.2.3: Field cannot be static if (Modifier.isStatic(field.getModifiers())) { - Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be static"); + LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be static"); return; } //JavaEE Spec 5.2.3: Field cannot be final if (Modifier.isFinal(field.getModifiers())) { - Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be final"); + LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be final"); return; } @@ -165,7 +168,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH //Check there is a JNDI entry for this annotation if (bound) { - Log.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name); + LOG.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name); // Make the Injection for it if the binding succeeded injection = new Injection(); injection.setTarget(clazz, field, type); @@ -230,7 +233,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH //JavaEE Spec 5.2.3: Method cannot be static if (Modifier.isStatic(method.getModifiers())) { - Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": cannot be static"); + LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": cannot be static"); return; } @@ -238,19 +241,19 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH // only 1 parameter if (!method.getName().startsWith("set")) { - Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, does not start with 'set'"); + LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, does not start with 'set'"); return; } if (method.getParameterTypes().length != 1) { - Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not single argument to method"); + LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not single argument to method"); return; } if (Void.TYPE != method.getReturnType()) { - Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not void"); + LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not void"); return; } @@ -320,7 +323,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH if (bound) { - Log.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name); + LOG.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name); // Make the Injection for it injection = new Injection(); injection.setTarget(clazz, method,paramType,resourceType); diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java index 90e71ced785..2cf7276be03 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourcesAnnotationHandler.java @@ -19,10 +19,13 @@ import javax.naming.NamingException; import org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.webapp.WebAppContext; public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotationHandler { + private static final Logger LOG = Log.getLogger(ResourcesAnnotationHandler.class); + protected WebAppContext _wac; @@ -40,7 +43,7 @@ public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotation Resource[] resArray = resources.value(); if (resArray==null||resArray.length==0) { - Log.warn ("Skipping empty or incorrect Resources annotation on "+clazz.getName()); + LOG.warn ("Skipping empty or incorrect Resources annotation on "+clazz.getName()); return; } @@ -62,11 +65,11 @@ public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotation if (!org.eclipse.jetty.plus.jndi.NamingEntryUtil.bindToENC(_wac, name, mappedName)) if (!org.eclipse.jetty.plus.jndi.NamingEntryUtil.bindToENC(_wac.getServer(), name, mappedName)) - Log.warn("Skipping Resources(Resource) annotation on "+clazz.getName()+" for name "+name+": No resource bound at "+(mappedName==null?name:mappedName)); + LOG.warn("Skipping Resources(Resource) annotation on "+clazz.getName()+" for name "+name+": No resource bound at "+(mappedName==null?name:mappedName)); } catch (NamingException e) { - Log.warn(e); + LOG.warn(e); } } } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java index 8e8e051d069..1e4e25d42d2 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/RunAsAnnotationHandler.java @@ -22,6 +22,7 @@ import org.eclipse.jetty.annotations.AnnotationParser.Value; import org.eclipse.jetty.plus.annotation.RunAsCollection; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.webapp.Descriptor; import org.eclipse.jetty.webapp.MetaData; import org.eclipse.jetty.webapp.WebAppContext; @@ -29,6 +30,8 @@ import org.eclipse.jetty.webapp.WebAppContext; public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHandler { + private static final Logger LOG = Log.getLogger(RunAsAnnotationHandler.class); + protected WebAppContext _context; public RunAsAnnotationHandler (WebAppContext wac) @@ -74,7 +77,7 @@ public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHand } } else - Log.warn("Bad value for @RunAs annotation on class "+clazz.getName()); + LOG.warn("Bad value for @RunAs annotation on class "+clazz.getName()); } } @@ -82,13 +85,13 @@ public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHand public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation, List values) { - Log.warn ("@RunAs annotation not applicable for fields: "+className+"."+fieldName); + LOG.warn ("@RunAs annotation not applicable for fields: "+className+"."+fieldName); } public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation, List values) { - Log.warn("@RunAs annotation ignored on method: "+className+"."+methodName+" "+signature); + LOG.warn("@RunAs annotation ignored on method: "+className+"."+methodName+" "+signature); } private ServletHolder getServletHolderForClass (Class clazz) diff --git a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java index 6a63b88b13f..66762719870 100644 --- a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java +++ b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java @@ -27,11 +27,14 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ public class ThreadMonitor extends AbstractLifeCycle implements Runnable { + private static final Logger LOG = Log.getLogger(ThreadMonitor.class); + private int _scanInterval; private int _logInterval; private int _busyThreshold; @@ -296,7 +299,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable _runner.setDaemon(true); _runner.start(); - Log.info("Thread Monitor started successfully"); + LOG.info("Thread Monitor started successfully"); } /* ------------------------------------------------------------ */ @@ -395,7 +398,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable } catch (InterruptedException ex) { - Log.ignore(ex); + LOG.ignore(ex); } } } @@ -486,7 +489,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable } catch (Exception ex) { - Log.debug(ex); + LOG.debug(ex); } return repeat; } diff --git a/jetty-nested/src/main/java/org/eclipse/jetty/nested/NestedGenerator.java b/jetty-nested/src/main/java/org/eclipse/jetty/nested/NestedGenerator.java index e549c1bdd07..3ab098ccf1c 100644 --- a/jetty-nested/src/main/java/org/eclipse/jetty/nested/NestedGenerator.java +++ b/jetty-nested/src/main/java/org/eclipse/jetty/nested/NestedGenerator.java @@ -25,9 +25,12 @@ import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; public class NestedGenerator extends AbstractGenerator { + private static final Logger LOG = Log.getLogger(NestedGenerator.class); + final HttpServletResponse _response; final String _nestedIn; @@ -40,7 +43,7 @@ public class NestedGenerator extends AbstractGenerator public void addContent(Buffer content, boolean last) throws IOException { - // Log.debug("addContent {} {}",content.length(),last); + // LOG.debug("addContent {} {}",content.length(),last); if (_noContent) { content.clear(); @@ -52,7 +55,7 @@ public class NestedGenerator extends AbstractGenerator if (_last || _state == STATE_END) { - Log.debug("Ignoring extra content {}", content); + LOG.debug("Ignoring extra content {}", content); content.clear(); return; } @@ -107,7 +110,7 @@ public class NestedGenerator extends AbstractGenerator public boolean addContent(byte b) throws IOException { - // Log.debug("addContent 1"); + // LOG.debug("addContent 1"); if (_noContent) return false; @@ -150,7 +153,7 @@ public class NestedGenerator extends AbstractGenerator { if (_buffer == null) { - // Log.debug("initContent"); + // LOG.debug("initContent"); _buffer = _buffers.getBuffer(); } } @@ -181,8 +184,8 @@ public class NestedGenerator extends AbstractGenerator @Override public void completeHeader(HttpFields fields, boolean allContentAdded) throws IOException { - if (Log.isDebugEnabled()) - Log.debug("completeHeader: {}",fields.toString().trim().replace("\r\n","|")); + if (LOG.isDebugEnabled()) + LOG.debug("completeHeader: {}",fields.toString().trim().replace("\r\n","|")); if (_state != STATE_HEADER) return; @@ -247,7 +250,7 @@ public class NestedGenerator extends AbstractGenerator int size=_buffer.length(); int len = _buffer==null?0:_endp.flush(_buffer); - Log.debug("flushBuffer {} of {}",len,size); + LOG.debug("flushBuffer {} of {}",len,size); if (len>0) _buffer.skip(len); diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java index 6418f09607c..cceb8551032 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.nosql.NoSqlSessionManager; import org.eclipse.jetty.server.SessionIdManager; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.log.Logger; import org.omg.CORBA._IDLTypeStub; import com.mongodb.BasicDBObject; @@ -36,7 +37,9 @@ import com.mongodb.DBObject; import com.mongodb.MongoException; public class MongoSessionManager extends NoSqlSessionManager -{ +{ + private static final Logger LOG = Log.getLogger(MongoSessionManager.class); + private final static Logger __log = Log.getLogger("org.eclipse.jetty.server.session"); /* @@ -184,7 +187,7 @@ public class MongoSessionManager extends NoSqlSessionManager } catch (Exception e) { - Log.warn(e); + LOG.warn(e); } return null; } @@ -265,7 +268,7 @@ public class MongoSessionManager extends NoSqlSessionManager } catch (Exception e) { - Log.warn(e); + LOG.warn(e); } return null; @@ -325,7 +328,7 @@ public class MongoSessionManager extends NoSqlSessionManager } catch (Exception e) { - Log.warn(e); + LOG.warn(e); } return null; } diff --git a/jetty-osgi/jetty-osgi-boot-jsp/src/main/java/org/eclipse/jetty/osgi/boot/jsp/TagLibOSGiConfiguration.java b/jetty-osgi/jetty-osgi-boot-jsp/src/main/java/org/eclipse/jetty/osgi/boot/jsp/TagLibOSGiConfiguration.java index 8ada3fa7f8a..510261db4d0 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/src/main/java/org/eclipse/jetty/osgi/boot/jsp/TagLibOSGiConfiguration.java +++ b/jetty-osgi/jetty-osgi-boot-jsp/src/main/java/org/eclipse/jetty/osgi/boot/jsp/TagLibOSGiConfiguration.java @@ -21,6 +21,7 @@ import java.util.LinkedHashSet; import org.eclipse.jetty.osgi.boot.OSGiWebappConstants; import org.eclipse.jetty.osgi.boot.utils.internal.DefaultFileLocatorHelper; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.webapp.TagLibConfiguration; import org.eclipse.jetty.webapp.WebAppContext; @@ -45,6 +46,8 @@ import org.osgi.util.tracker.ServiceTracker; */ public class TagLibOSGiConfiguration extends TagLibConfiguration { + private static final Logger LOG = Log.getLogger(TagLibOSGiConfiguration.class); + private ServiceTracker packageAdminServiceTracker = null; /** @@ -128,7 +131,7 @@ public class TagLibOSGiConfiguration extends TagLibConfiguration } if (!atLeastOneTldFound) { - Log.warn("No '/META-INF/*.tld' resources were found " + LOG.warn("No '/META-INF/*.tld' resources were found " + " in the bundle '" + bs[0].getSymbolicName() + "' while registering the " + OSGiWebappConstants.REQUIRE_TLD_BUNDLE diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiAppProvider.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiAppProvider.java index df97beda779..fe3fa1ad792 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiAppProvider.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiAppProvider.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.Scanner; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.webapp.WebAppContext; import org.osgi.framework.Bundle; @@ -60,6 +61,8 @@ import org.osgi.framework.Constants; */ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider { + private static final Logger LOG = Log.getLogger(OSGiAppProvider.class); + private boolean _extractWars = true; private boolean _parentLoaderPriority = false; @@ -190,6 +193,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider /** * @see AppProvider */ + @Override public void setDeploymentManager(DeploymentManager deploymentManager) { // _manager=deploymentManager; @@ -456,6 +460,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider /** * Overridden to install the OSGi bundles found in the monitored folder. */ + @Override protected void doStart() throws Exception { if (isAutoInstallOSGiBundles()) @@ -463,7 +468,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider if (getMonitoredDirResource() == null) { setAutoInstallOSGiBundles(false); - Log.info("Disable autoInstallOSGiBundles as there is not contexts folder to monitor."); + LOG.info("Disable autoInstallOSGiBundles as there is not contexts folder to monitor."); } else { @@ -474,14 +479,14 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider if (!scandir.exists() || !scandir.isDirectory()) { setAutoInstallOSGiBundles(false); - Log.warn("Disable autoInstallOSGiBundles as the contexts folder '" + scandir.getAbsolutePath() + " does not exist."); + LOG.warn("Disable autoInstallOSGiBundles as the contexts folder '" + scandir.getAbsolutePath() + " does not exist."); scandir = null; } } catch (IOException ioe) { setAutoInstallOSGiBundles(false); - Log.warn("Disable autoInstallOSGiBundles as the contexts folder '" + getMonitoredDirResource().getURI() + " does not exist."); + LOG.warn("Disable autoInstallOSGiBundles as the contexts folder '" + getMonitoredDirResource().getURI() + " does not exist."); scandir = null; } if (scandir != null) @@ -610,7 +615,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider { //not sure we will ever be here, //most likely a BundleException was thrown - Log.warn("The file " + location + " is not an OSGi bundle."); + LOG.warn("The file " + location + " is not an OSGi bundle."); return null; } if (start && b.getHeaders().get(Constants.FRAGMENT_HOST) == null) @@ -633,7 +638,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider } catch (BundleException e) { - Log.warn("Unable to " + (start? "start":"install") + " the bundle " + file.getAbsolutePath(), e); + LOG.warn("Unable to " + (start? "start":"install") + " the bundle " + file.getAbsolutePath(), e); } return null; } @@ -648,7 +653,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider } catch (BundleException e) { - Log.warn("Unable to uninstall the bundle " + file.getAbsolutePath(), e); + LOG.warn("Unable to uninstall the bundle " + file.getAbsolutePath(), e); } } @@ -672,7 +677,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider } catch (BundleException e) { - Log.warn("Unable to update the bundle " + file.getAbsolutePath(), e); + LOG.warn("Unable to update the bundle " + file.getAbsolutePath(), e); } } @@ -684,6 +689,8 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider */ class AutoStartWhenFrameworkHasCompleted implements Scanner.ScanCycleListener { + private static final Logger LOG = Log.getLogger(AutoStartWhenFrameworkHasCompleted.class); + private final OSGiAppProvider _appProvider; AutoStartWhenFrameworkHasCompleted(OSGiAppProvider appProvider) @@ -713,7 +720,7 @@ class AutoStartWhenFrameworkHasCompleted implements Scanner.ScanCycleListener } catch (BundleException e) { - Log.warn("Unable to start the bundle " + b.getLocation(), e); + LOG.warn("Unable to start the bundle " + b.getLocation(), e); } } diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java index 3c9878fb169..c07ab027131 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java @@ -27,6 +27,7 @@ import org.eclipse.jetty.osgi.boot.OSGiServerConstants; import org.eclipse.jetty.osgi.boot.utils.BundleFileLocatorHelper; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -36,6 +37,8 @@ import org.osgi.framework.BundleContext; * then setup the corresponding jetty server and starts it. */ public class DefaultJettyAtJettyHomeHelper { + private static final Logger LOG = Log.getLogger(DefaultJettyAtJettyHomeHelper.class); + /** * contains a comma separated list of pathes to the etc/jetty-*.xml files @@ -101,13 +104,13 @@ public class DefaultJettyAtJettyHomeHelper { } if (jettyHomeBundleSysProp != null) { - Log.warn("Both the jetty.home property and the jetty.home.bundle property are defined." + LOG.warn("Both the jetty.home property and the jetty.home.bundle property are defined." + " jetty.home.bundle is not taken into account."); } jettyHome = new File(jettyHomeSysProp); if (!jettyHome.exists() || !jettyHome.isDirectory()) { - Log.warn("Unable to locate the jetty.home folder " + jettyHomeSysProp); + LOG.warn("Unable to locate the jetty.home folder " + jettyHomeSysProp); return; } } @@ -124,14 +127,14 @@ public class DefaultJettyAtJettyHomeHelper { } if (jettyHomeBundle == null) { - Log.warn("Unable to find the jetty.home.bundle named " + jettyHomeSysProp); + LOG.warn("Unable to find the jetty.home.bundle named " + jettyHomeSysProp); return; } } if (jettyHome == null && jettyHomeBundle == null) { - Log.warn("No default jetty started."); + LOG.warn("No default jetty started."); return; } try @@ -143,7 +146,7 @@ public class DefaultJettyAtJettyHomeHelper { String configURLs = jettyHome != null ? getJettyConfigurationURLs(jettyHome) : getJettyConfigurationURLs(jettyHomeBundle); properties.put(OSGiServerConstants.MANAGED_JETTY_XML_CONFIG_URLS, configURLs); - Log.info("Configuring the default jetty server with " + configURLs); + LOG.info("Configuring the default jetty server with " + configURLs); //these properties usually are the ones passed to this type of configuration. setProperty(properties,SYS_PROP_JETTY_HOME,System.getProperty(SYS_PROP_JETTY_HOME)); diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java index 9ae3fb7f3d2..3cfea34c932 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleTrackerCustomizer.java @@ -18,6 +18,7 @@ import java.util.Dictionary; import org.eclipse.jetty.osgi.boot.JettyBootstrapActivator; import org.eclipse.jetty.osgi.boot.OSGiWebappConstants; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.osgi.framework.Bundle; import org.osgi.framework.BundleEvent; import org.osgi.util.tracker.BundleTracker; @@ -49,6 +50,8 @@ import org.osgi.util.tracker.BundleTrackerCustomizer; * @author hmalphettes */ public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer { + private static final Logger LOG = Log.getLogger(WebBundleTrackerCustomizer.class); + /** @@ -152,7 +155,7 @@ public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer { String contextPath = getWebContextPath(bundle, dic, false);//(String)dic.get(OSGiWebappConstants.RFC66_WEB_CONTEXTPATH); if (contextPath == null || !contextPath.startsWith("/")) { - Log.warn("The manifest header '" + OSGiWebappConstants.JETTY_WAR_FOLDER_PATH + + LOG.warn("The manifest header '" + OSGiWebappConstants.JETTY_WAR_FOLDER_PATH + ": " + warFolderRelativePath + "' in the bundle " + bundle.getSymbolicName() + " is not valid: there is no Web-ContextPath defined in the manifest."); return false; @@ -166,7 +169,7 @@ public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer { } catch (Throwable e) { - Log.warn("Starting the web-bundle " + bundle.getSymbolicName() + " threw an exception.", e); + LOG.warn("Starting the web-bundle " + bundle.getSymbolicName() + " threw an exception.", e); return true;//maybe it did not work maybe it did. safer to track this bundle. } } diff --git a/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/WebEquinoxToolsActivator.java b/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/WebEquinoxToolsActivator.java index 847b9fafe71..1477e0d602b 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/WebEquinoxToolsActivator.java +++ b/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/WebEquinoxToolsActivator.java @@ -20,6 +20,7 @@ import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxConsoleSyncServlet; import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxConsoleWebSocketServlet; import org.eclipse.jetty.osgi.equinoxtools.console.WebConsoleSession; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.osgi.framework.console.ConsoleSession; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -34,6 +35,8 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer; */ public class WebEquinoxToolsActivator implements BundleActivator { + private static final Logger LOG = Log.getLogger(WebEquinoxToolsActivator.class); + private static BundleContext context; public static BundleContext getContext() @@ -95,11 +98,11 @@ public class WebEquinoxToolsActivator implements BundleActivator } catch (ServletException e) { - Log.warn(e); + LOG.warn(e); } catch (NamespaceException e) { - Log.warn(e); + LOG.warn(e); } return _httpService; } diff --git a/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/console/EquinoxConsoleWebSocketServlet.java b/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/console/EquinoxConsoleWebSocketServlet.java index d340d97bfd8..f56e88fb5e2 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/console/EquinoxConsoleWebSocketServlet.java +++ b/jetty-osgi/jetty-osgi-equinoxtools/src/main/java/org/eclipse/jetty/osgi/equinoxtools/console/EquinoxConsoleWebSocketServlet.java @@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.osgi.equinoxtools.WebEquinoxToolsActivator; import org.eclipse.jetty.osgi.equinoxtools.console.WebConsoleWriterOutputStream.OnFlushListener; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.WebSocket; import org.eclipse.jetty.websocket.WebSocketServlet; import org.eclipse.osgi.framework.console.ConsoleSession; @@ -34,6 +35,8 @@ import org.eclipse.osgi.framework.console.ConsoleSession; */ public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements OnFlushListener { + private static final Logger LOG = Log.getLogger(EquinoxConsoleWebSocketServlet.class); + private final Set _members = new CopyOnWriteArraySet(); private static final long serialVersionUID = 1L; private WebConsoleSession _consoleSession; @@ -93,19 +96,19 @@ public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements public void onOpen(Connection connection) { - // Log.info(this+" onConnect"); + // LOG.info(this+" onConnect"); _connection=connection; _members.add(this); } public void onMessage(byte frame, byte[] data,int offset, int length) { - // Log.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length)); + // LOG.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length)); } public void onMessage(String data) { - Log.info("onMessage: {}",data); + LOG.info("onMessage: {}",data); if (data.indexOf("disconnect")>=0) _connection.disconnect(); else @@ -129,14 +132,14 @@ public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements { _username = data.substring(0, data.length()-":has joined!".length()); } - // Log.info(this+" onMessage: "+data); + // LOG.info(this+" onMessage: "+data); onFlush(); } } public void onClose(int code, String message) { - // Log.info(this+" onDisconnect"); + // LOG.info(this+" onDisconnect"); _members.remove(this); } @@ -165,7 +168,7 @@ public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements } catch(IOException e) { - Log.warn(e); + LOG.warn(e); } } } diff --git a/jetty-osgi/jetty-osgi-servletbridge/src/main/java/org/eclipse/jetty/nested/Dump.java b/jetty-osgi/jetty-osgi-servletbridge/src/main/java/org/eclipse/jetty/nested/Dump.java index 6895129e4f2..9a178a2e834 100644 --- a/jetty-osgi/jetty-osgi-servletbridge/src/main/java/org/eclipse/jetty/nested/Dump.java +++ b/jetty-osgi/jetty-osgi-servletbridge/src/main/java/org/eclipse/jetty/nested/Dump.java @@ -52,6 +52,7 @@ import javax.sql.DataSource; //import org.eclipse.jetty.http.HttpHeaders; //import org.eclipse.jetty.util.StringUtil; //import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; @@ -61,6 +62,8 @@ import javax.sql.DataSource; */ public class Dump extends HttpServlet { + private static final Logger LOG = Log.getLogger(Dump.class); + boolean fixed; /* ------------------------------------------------------------ */ @@ -211,7 +214,7 @@ public class Dump extends HttpServlet } catch (IOException e) { - Log.ignore(e); + LOG.ignore(e); } } diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java index d4ee9288cd1..fc992fc38ae 100644 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java +++ b/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java @@ -36,6 +36,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.security.CertificateValidator; @@ -59,7 +60,9 @@ import org.eclipse.jetty.util.security.CertificateValidator; * - check performance of the synch'd map I am using for the protection domain mapping */ public class JettyPolicy extends Policy -{ +{ + private static final Logger LOG = Log.getLogger(JettyPolicy.class); + private static boolean __DEBUG = false; private static boolean __RELOAD = false; @@ -363,7 +366,7 @@ public class JettyPolicy extends Policy { try { - Log.info(message); + LOG.info(message); } catch ( AccessControlException ace ) { @@ -396,7 +399,7 @@ public class JettyPolicy extends Policy { try { - Log.info(message, t); + LOG.info(message, t); } catch ( AccessControlException ace ) { diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RuleContainer.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RuleContainer.java index 2b95d12143d..201d4fadab1 100644 --- a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RuleContainer.java +++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RuleContainer.java @@ -23,6 +23,7 @@ import org.eclipse.jetty.server.HttpConnection; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.util.LazyList; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** * Base container to group rules. Can be extended so that the contained rules @@ -33,6 +34,8 @@ import org.eclipse.jetty.util.log.Log; public class RuleContainer extends Rule { + private static final Logger LOG = Log.getLogger(RuleContainer.class); + protected Rule[] _rules; protected String _originalPathAttribute; @@ -194,10 +197,10 @@ public class RuleContainer extends Rule String applied=rule.matchAndApply(target,request, response); if (applied!=null) { - Log.debug("applied {}",rule); + LOG.debug("applied {}",rule); if (!target.equals(applied)) { - Log.debug("rewrote {} to {}",target,applied); + LOG.debug("rewrote {} to {}",target,applied); if (!original_set) { original_set=true; @@ -220,13 +223,13 @@ public class RuleContainer extends Rule if (rule.isHandling()) { - Log.debug("handling {}",rule); + LOG.debug("handling {}",rule); (request instanceof Request?(Request)request:HttpConnection.getCurrentConnection().getRequest()).setHandled(true); } if (rule.isTerminating()) { - Log.debug("terminating {}",rule); + LOG.debug("terminating {}",rule); break; } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java b/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java index 24914935709..e6ae64bd30e 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java @@ -42,6 +42,8 @@ import java.util.Map; */ public class UrlEncoded extends MultiMap { + // private static final Logger LOG = Log.getLogger(UrlEncoded.class); + public static final String ENCODING = System.getProperty("org.eclipse.jetty.util.UrlEncoding.charset",StringUtil.__UTF8); /* ----------------------------------------------------------------- */ @@ -811,7 +813,7 @@ public class UrlEncoded extends MultiMap } catch(UnsupportedEncodingException e) { - // Log.warn(LogSupport.EXCEPTION,e); + // LOG.warn(LogSupport.EXCEPTION,e); bytes=string.getBytes(); } @@ -861,7 +863,7 @@ public class UrlEncoded extends MultiMap } catch(UnsupportedEncodingException e) { - // Log.warn(LogSupport.EXCEPTION,e); + // LOG.warn(LogSupport.EXCEPTION,e); return new String(encoded,0,n); } } diff --git a/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java b/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java index f8a88cd5dca..77c37e79273 100644 --- a/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java +++ b/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java @@ -48,6 +48,7 @@ import org.eclipse.jetty.continuation.ContinuationSupport; import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; @@ -57,6 +58,8 @@ import org.eclipse.jetty.util.log.Log; */ public class Dump extends HttpServlet { + private static final Logger LOG = Log.getLogger(Dump.class); + boolean fixed; /* ------------------------------------------------------------ */ @@ -207,7 +210,7 @@ public class Dump extends HttpServlet } catch (IOException e) { - Log.ignore(e); + LOG.ignore(e); } } diff --git a/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java b/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java index e35c1c09c61..3813860f49e 100644 --- a/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java +++ b/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java @@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ @@ -36,6 +37,8 @@ import org.eclipse.jetty.util.log.Log; */ public class DispatchServlet extends HttpServlet { + private static final Logger LOG = Log.getLogger(DispatchServlet.class); + /* ------------------------------------------------------------ */ String pageType; @@ -156,7 +159,7 @@ public class DispatchServlet extends HttpServlet } catch(IOException e) { - Log.ignore(e); + LOG.ignore(e); } } else diff --git a/test-jetty-webapp/src/main/java/com/acme/Dump.java b/test-jetty-webapp/src/main/java/com/acme/Dump.java index 24189e27b1c..0da3a69dbfc 100644 --- a/test-jetty-webapp/src/main/java/com/acme/Dump.java +++ b/test-jetty-webapp/src/main/java/com/acme/Dump.java @@ -51,6 +51,7 @@ import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; @@ -60,6 +61,8 @@ import org.eclipse.jetty.util.log.Log; */ public class Dump extends HttpServlet { + private static final Logger LOG = Log.getLogger(Dump.class); + boolean fixed; /* ------------------------------------------------------------ */ @@ -240,7 +243,7 @@ public class Dump extends HttpServlet } catch (IOException e) { - Log.ignore(e); + LOG.ignore(e); } } diff --git a/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java b/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java index 6a714dc2828..70777d1fb5e 100644 --- a/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java +++ b/test-jetty-webapp/src/main/java/com/acme/SecureModeServlet.java @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ @@ -37,6 +38,8 @@ import org.eclipse.jetty.util.log.Log; */ public class SecureModeServlet extends HttpServlet { + private static final Logger LOG = Log.getLogger(SecureModeServlet.class); + /* ------------------------------------------------------------ */ @Override public void init(ServletConfig config) throws ServletException @@ -118,7 +121,7 @@ public class SecureModeServlet extends HttpServlet try { out.println("check ability to log
"); - Log.info("testing logging"); + LOG.info("testing logging"); out.println("status: SUCCESS - expected
"); } catch (SecurityException e) diff --git a/test-jetty-webapp/src/main/java/com/acme/TestFilter.java b/test-jetty-webapp/src/main/java/com/acme/TestFilter.java index 2ed89725207..3712a2c7db4 100644 --- a/test-jetty-webapp/src/main/java/com/acme/TestFilter.java +++ b/test-jetty-webapp/src/main/java/com/acme/TestFilter.java @@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ /** TestFilter. @@ -41,6 +42,8 @@ import org.eclipse.jetty.util.log.Log; */ public class TestFilter implements Filter { + private static final Logger LOG = Log.getLogger(TestFilter.class); + private boolean _remote; private ServletContext _context; private final Set _allowed = new HashSet(); @@ -56,7 +59,7 @@ public class TestFilter implements Filter _allowed.add("/favicon.ico"); _allowed.add("/jetty_banner.gif"); - Log.debug("TestFilter#remote="+_remote); + LOG.debug("TestFilter#remote="+_remote); } /* ------------------------------------------------------------ */ diff --git a/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java b/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java index 68689ffbec5..378a6c56aa0 100644 --- a/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java +++ b/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java @@ -10,11 +10,14 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.WebSocket; import org.eclipse.jetty.websocket.WebSocketServlet; public class WebSocketChatServlet extends WebSocketServlet { + private static final Logger LOG = Log.getLogger(WebSocketChatServlet.class); + private final Set _members = new CopyOnWriteArraySet(); @Override @@ -37,14 +40,14 @@ public class WebSocketChatServlet extends WebSocketServlet public void onOpen(Connection connection) { - // Log.info(this+" onConnect"); + // LOG.info(this+" onConnect"); _connection=connection; _members.add(this); } public void onMessage(byte frame, byte[] data,int offset, int length) { - // Log.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length)); + // LOG.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length)); } public void onMessage(String data) @@ -53,7 +56,7 @@ public class WebSocketChatServlet extends WebSocketServlet _connection.disconnect(); else { - // Log.info(this+" onMessage: "+data); + // LOG.info(this+" onMessage: "+data); for (ChatWebSocket member : _members) { try @@ -62,7 +65,7 @@ public class WebSocketChatServlet extends WebSocketServlet } catch(IOException e) { - Log.warn(e); + LOG.warn(e); } } } @@ -70,7 +73,7 @@ public class WebSocketChatServlet extends WebSocketServlet public void onClose(int code, String message) { - // Log.info(this+" onDisconnect"); + // LOG.info(this+" onDisconnect"); _members.remove(this); } diff --git a/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java b/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java index 213a165425b..c5fb5d9d0ac 100644 --- a/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java +++ b/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java @@ -41,6 +41,7 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.session.HashSessionManager; import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.webapp.WebAppContext; @@ -49,6 +50,8 @@ import org.junit.Ignore; @Ignore("Not a test case") public class TestServer { + private static final Logger LOG = Log.getLogger(TestServer.class); + public static void main(String[] args) throws Exception { ((StdErrLog)Log.getLog()).setSource(false); @@ -189,7 +192,7 @@ public class TestServer } catch(Exception e) { - Log.warn(e); + LOG.warn(e); } } }.start(); diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java index a2552a402e7..3a071047195 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpsSocketImpl.java @@ -30,12 +30,15 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** * An HTTPS Socket Impl */ public class HttpsSocketImpl implements HttpSocket { + private static final Logger LOG = Log.getLogger(HttpsSocketImpl.class); + private SSLContext sslContext; private SSLSocketFactory sslfactory; @@ -66,7 +69,7 @@ public class HttpsSocketImpl implements HttpSocket { public boolean verify(String urlHostName, SSLSession session) { - Log.warn("Warning: URL Host: " + urlHostName + " vs." + session.getPeerHost()); + LOG.warn("Warning: URL Host: " + urlHostName + " vs." + session.getPeerHost()); return true; } };