From cd0628ab66dcece88b20acb20eaa2c64f9866fa0 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Sat, 22 Oct 2011 09:39:54 +1100 Subject: [PATCH] Added isDebugEnabled guards to debugging that generates garbage --- .../eclipse/jetty/client/HttpExchange.java | 3 +- .../eclipse/jetty/client/SelectConnector.java | 3 +- .../jetty/deploy/DeploymentManager.java | 2 +- .../eclipse/jetty/deploy/WebAppDeployer.java | 2 +- .../deploy/bindings/StandardUndeployer.java | 7 ++- .../deploy/providers/ScanningAppProvider.java | 12 ++-- .../org/eclipse/jetty/http/HttpGenerator.java | 6 +- .../jetty/http/ssl/SslContextFactory.java | 4 +- .../io/nio/SslSelectChannelEndPoint.java | 12 ++-- .../org/eclipse/jetty/jmx/MBeanContainer.java | 24 ++++---- .../jetty/rewrite/handler/ProxyRule.java | 4 +- .../jetty/security/HashLoginService.java | 3 +- .../jetty/security/JDBCLoginService.java | 2 +- .../jetty/security/SpnegoLoginService.java | 2 +- .../authentication/DigestAuthenticator.java | 3 +- .../jetty/server/AbstractConnector.java | 5 +- .../eclipse/jetty/server/HttpConnection.java | 3 +- .../jetty/server/handler/ContextHandler.java | 5 +- .../jetty/server/session/AbstractSession.java | 10 ++-- .../session/AbstractSessionManager.java | 2 +- .../server/session/HashSessionManager.java | 2 +- .../jetty/server/session/HashedSession.java | 3 - .../server/session/JDBCSessionIdManager.java | 16 ++++-- .../server/session/JDBCSessionManager.java | 9 ++- .../jetty/server/session/SessionHandler.java | 15 ++--- .../eclipse/jetty/servlet/DefaultServlet.java | 3 +- .../org/eclipse/jetty/servlet/Holder.java | 3 +- .../org/eclipse/jetty/servlet/Invoker.java | 8 ++- .../eclipse/jetty/servlet/ServletHandler.java | 16 ++++-- .../jetty/servlets/CrossOriginFilter.java | 35 ++++++------ .../util/component/AbstractLifeCycle.java | 2 +- .../util/component/AggregateLifeCycle.java | 2 +- .../java/org/eclipse/jetty/util/log/Log.java | 56 +++++++++---------- .../jetty/util/resource/JarResource.java | 12 ++-- .../jetty/util/thread/ShutdownThread.java | 2 +- .../webapp/JettyWebXmlConfiguration.java | 8 +-- .../webapp/StandardDescriptorProcessor.java | 3 +- .../jetty/webapp/TagLibConfiguration.java | 3 +- .../eclipse/jetty/webapp/WebAppContext.java | 4 +- .../eclipse/jetty/webapp/WebDescriptor.java | 3 +- .../jetty/webapp/WebInfConfiguration.java | 3 +- .../jetty/webapp/WebXmlConfiguration.java | 5 +- 42 files changed, 185 insertions(+), 142 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java index 6840adcabd2..6e70e830ddf 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java @@ -593,7 +593,8 @@ public class HttpExchange if (uri.isOpaque()) throw new IllegalArgumentException("Opaque URI: " + uri); - LOG.debug("URI = {}",uri.toASCIIString()); + if (LOG.isDebugEnabled()) + LOG.debug("URI = {}",uri.toASCIIString()); String scheme = uri.getScheme(); int port = uri.getPort(); diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index 853e7e70f4d..847823d9ca9 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -168,7 +168,8 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector Timeout.Task connectTimeout = _connectingChannels.remove(channel); if (connectTimeout != null) connectTimeout.cancel(); - LOG.debug("Channels with connection pending: {}", _connectingChannels.size()); + if (LOG.isDebugEnabled()) + LOG.debug("Channels with connection pending: {}", _connectingChannels.size()); // key should have destination at this point (will be replaced by endpoint after this call) HttpDestination dest=(HttpDestination)key.attachment(); diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java index 0cb29ccc7c1..fb8e1a5d36b 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java @@ -481,7 +481,7 @@ public class DeploymentManager extends AggregateLifeCycle while (it.hasNext()) { Node node = it.next(); - LOG.debug("Executing Node: " + node); + LOG.debug("Executing Node {}",node); _lifecycle.runBindings(node,appentry.app,this); appentry.setLifeCycleNode(node); } diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java index 81e641cbfdf..6cbb2d6fc39 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java @@ -257,7 +257,7 @@ public class WebAppDeployer extends AbstractLifeCycle if (path != null && path.equals(app.getFile().getCanonicalPath())) { - LOG.debug("Already deployed:"+path); + LOG.debug("Already deployed: {}",path); continue files; } } diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java index 0a5c08c6bdf..c7119dafd33 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java @@ -51,13 +51,14 @@ public class StandardUndeployer implements AppLifeCycle.Binding for (int i = 0, n = children.length; i < n; i++) { Handler child = children[i]; - LOG.debug("Child handler: " + child); + LOG.debug("Child handler {}",child); if (child.equals(context)) { - LOG.debug("Removing handler: " + child); + LOG.debug("Removing handler {}",child); coll.removeHandler(child); child.destroy(); - LOG.debug(String.format("After removal: %d (originally %d)",coll.getHandlers().length,originalCount)); + if (LOG.isDebugEnabled()) + LOG.debug("After removal: {} (originally {})",coll.getHandlers().length,originalCount); } else if (child instanceof HandlerCollection) { diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java index 629f13f92ec..8bf03f30a12 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java @@ -99,7 +99,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A @Override protected void doStart() throws Exception { - if (LOG.isDebugEnabled()) LOG.debug(this.getClass().getSimpleName() + ".doStart()"); + if (LOG.isDebugEnabled()) + LOG.debug(this.getClass().getSimpleName() + ".doStart()"); if (_monitoredDir == null) { throw new IllegalStateException("No configuration dir specified"); @@ -132,7 +133,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A /* ------------------------------------------------------------ */ protected void fileAdded(String filename) throws Exception { - if (LOG.isDebugEnabled()) LOG.debug("added ",filename); + if (LOG.isDebugEnabled()) + LOG.debug("added {}",filename); App app = ScanningAppProvider.this.createApp(filename); if (app != null) { @@ -144,7 +146,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A /* ------------------------------------------------------------ */ protected void fileChanged(String filename) throws Exception { - if (LOG.isDebugEnabled()) LOG.debug("changed ",filename); + if (LOG.isDebugEnabled()) + LOG.debug("changed {}",filename); App app = _appMap.remove(filename); if (app != null) { @@ -161,7 +164,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A /* ------------------------------------------------------------ */ protected void fileRemoved(String filename) throws Exception { - if (LOG.isDebugEnabled()) LOG.debug("removed ",filename); + if (LOG.isDebugEnabled()) + LOG.debug("removed {}",filename); App app = _appMap.remove(filename); if (app != null) _deploymentManager.removeApp(app); diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java index d83cb890bec..c2c44377839 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java @@ -157,7 +157,8 @@ public class HttpGenerator extends AbstractGenerator if (_last || _state==STATE_END) { - LOG.debug("Ignoring extra content {}",content); + if (LOG.isDebugEnabled()) + LOG.debug("Ignoring extra content {}",content.toDetailString()); content.clear(); return; } @@ -242,7 +243,8 @@ public class HttpGenerator extends AbstractGenerator if (_last || _state==STATE_END) { - LOG.debug("Ignoring extra content {}",Byte.valueOf(b)); + if (LOG.isDebugEnabled()) + LOG.debug("Ignoring extra content {}",Byte.valueOf(b)); return false; } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java index 86e53a270d7..4645a199c69 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java @@ -299,8 +299,10 @@ public class SslContextFactory extends AbstractLifeCycle _context.init(keyManagers,trustManagers,secureRandom); SSLEngine engine=newSslEngine(); + LOG.info("Enabled Protocols {} of {}",Arrays.asList(engine.getEnabledProtocols()),Arrays.asList(engine.getSupportedProtocols())); - LOG.debug("Enabled Ciphers {} of {}",Arrays.asList(engine.getEnabledCipherSuites()),Arrays.asList(engine.getSupportedCipherSuites())); + if (LOG.isDebugEnabled()) + LOG.debug("Enabled Ciphers {} of {}",Arrays.asList(engine.getEnabledCipherSuites()),Arrays.asList(engine.getSupportedCipherSuites())); } } } diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslSelectChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslSelectChannelEndPoint.java index 4b883f598e8..959be6b92df 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslSelectChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslSelectChannelEndPoint.java @@ -72,7 +72,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint _engine=engine; _session=engine.getSession(); - if (_debug) LOG.debug(_session+" channel="+channel); + if (_debug) + LOG.debug(_session+" channel="+channel); } /* ------------------------------------------------------------ */ @@ -86,7 +87,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint _engine=engine; _session=engine.getSession(); - if (_debug) LOG.debug(_session+" channel="+channel); + if (_debug) + LOG.debug(_session+" channel="+channel); } @@ -503,7 +505,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint int total_filled=0; boolean remoteClosed = false; - LOG.debug("{} unwrap space={} open={}",_session,_inNIOBuffer.space(),super.isOpen()); + if (LOG.isDebugEnabled()) + LOG.debug("{} unwrap space={} open={}",_session,_inNIOBuffer.space(),super.isOpen()); // loop filling as much encrypted data as we can into the buffer while (_inNIOBuffer.space()>0 && super.isOpen()) @@ -637,7 +640,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint out_buffer.position(_outNIOBuffer.putIndex()); out_buffer.limit(out_buffer.capacity()); _result=_engine.wrap(bbuf,out_buffer); - if (_debug) LOG.debug("{} wrap {}",_session,_result); + if (_debug) + LOG.debug("{} wrap {}",_session,_result); if (!_handshook && _result.getHandshakeStatus()==SSLEngineResult.HandshakeStatus.FINISHED) _handshook=true; _outNIOBuffer.setPutIndex(out_buffer.position()); diff --git a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java index 5371c8b60dc..582ac3b604a 100644 --- a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java +++ b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java @@ -41,7 +41,7 @@ import org.eclipse.jetty.util.thread.ShutdownThread; */ public class MBeanContainer extends AbstractLifeCycle implements Container.Listener, Dumpable { - private final static Logger __log = Log.getLogger(MBeanContainer.class.getName()); + private final static Logger LOG = Log.getLogger(MBeanContainer.class.getName()); private final MBeanServer _server; private final WeakHashMap _beans = new WeakHashMap(); @@ -93,7 +93,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste } catch (Exception e) { - __log.ignore(e); + LOG.ignore(e); } } @@ -134,7 +134,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste */ public synchronized void add(Relationship relationship) { - __log.debug("add {}",relationship); + LOG.debug("add {}",relationship); ObjectName parent = _beans.get(relationship.getParent()); if (parent == null) { @@ -168,7 +168,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste */ public synchronized void remove(Relationship relationship) { - __log.debug("remove {}",relationship); + LOG.debug("remove {}",relationship); ObjectName parent = _beans.get(relationship.getParent()); ObjectName child = _beans.get(relationship.getChild()); @@ -194,7 +194,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste */ public synchronized void removeBean(Object obj) { - __log.debug("removeBean {}",obj); + LOG.debug("removeBean {}",obj); ObjectName bean = _beans.remove(obj); if (bean != null) @@ -202,7 +202,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste List beanRelations= _relations.remove(bean); if (beanRelations != null) { - __log.debug("Unregister {}", beanRelations); + LOG.debug("Unregister {}", beanRelations); List removeList = new ArrayList(beanRelations); for (Object r : removeList) { @@ -214,15 +214,15 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste try { _server.unregisterMBean(bean); - __log.debug("Unregistered {}", bean); + LOG.debug("Unregistered {}", bean); } catch (javax.management.InstanceNotFoundException e) { - __log.ignore(e); + LOG.ignore(e); } catch (Exception e) { - __log.warn(e); + LOG.warn(e); } } } @@ -234,7 +234,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste */ public synchronized void addBean(Object obj) { - __log.debug("addBean {}",obj); + LOG.debug("addBean {}",obj); try { if (obj == null || _beans.containsKey(obj)) @@ -298,13 +298,13 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste } ObjectInstance oinstance = _server.registerMBean(mbean, oname); - __log.debug("Registered {}", oinstance.getObjectName()); + LOG.debug("Registered {}", oinstance.getObjectName()); _beans.put(obj, oinstance.getObjectName()); } catch (Exception e) { - __log.warn("bean: " + obj, e); + LOG.warn("bean: " + obj, e); } } diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java index 99c6877e52b..ef624f5a74f 100644 --- a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java +++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java @@ -280,7 +280,7 @@ public class ProxyRule extends PatternRule if (debug != 0) { - _log.debug(debug + " " + request.getMethod() + " " + url + " " + request.getProtocol()); + _log.debug("{} {} {} {}", debug ,request.getMethod(), url, request.getProtocol()); } boolean hasContent = createHeaders(request,debug,exchange); @@ -393,7 +393,7 @@ public class ProxyRule extends PatternRule if (val != null) { if (debug != 0) - _log.debug(debug + " " + hdr + ": " + val); + _log.debug("{} {} {}",debug,hdr,val); exchange.setRequestHeader(hdr,val); } diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java index 12b51f51502..9b833f5adbb 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java @@ -135,9 +135,8 @@ public class HashLoginService extends MappedLoginService implements UserListener if (_propertyUserStore == null) { if(LOG.isDebugEnabled()) - { LOG.debug("doStart: Starting new PropertyUserStore. PropertiesFile: " + _config + " refreshInterval: " + _refreshInterval); - } + _propertyUserStore = new PropertyUserStore(); _propertyUserStore.setRefreshInterval(_refreshInterval); _propertyUserStore.setConfig(_config); diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java index 03a4786efbb..20942b1e579 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/JDBCLoginService.java @@ -137,7 +137,7 @@ public class JDBCLoginService extends MappedLoginService || _password == null || _cacheTime < 0) { - if (LOG.isDebugEnabled()) LOG.debug("UserRealm " + getName() + " has not been properly configured"); + LOG.warn("UserRealm " + getName() + " has not been properly configured"); } _cacheTime *= 1000; _lastHashPurge = 0; diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java index f4949b05d40..0f8c0a2de83 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/SpnegoLoginService.java @@ -100,7 +100,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic _targetName = properties.getProperty("targetName"); - LOG.debug("\n\nTarget Name\n\n" + _targetName); + LOG.debug("Target Name {}", _targetName); super.doStart(); } diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java index 5a2ecf412e8..ca5d2cd7cf8 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java @@ -117,7 +117,8 @@ public class DigestAuthenticator extends LoginAuthenticator boolean stale = false; if (credentials != null) { - if (LOG.isDebugEnabled()) LOG.debug("Credentials: " + credentials); + if (LOG.isDebugEnabled()) + LOG.debug("Credentials: " + credentials); QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(credentials, "=, ", true, false); final Digest digest = new Digest(request.getMethod()); String last = null; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 199d0e18e26..fc8d5aca8cf 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -634,7 +634,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector public void setForwarded(boolean check) { if (check) - LOG.debug(this + " is forwarded"); + LOG.debug("{} is forwarded",this); _forwarded = check; } @@ -1001,7 +1001,8 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector if (on && _statsStartedAt.get() != -1) return; - LOG.debug("Statistics on = " + on + " for " + this); + if (LOG.isDebugEnabled()) + LOG.debug("Statistics on = " + on + " for " + this); statsReset(); _statsStartedAt.set(on?System.currentTimeMillis():-1); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index 3f1d327d75b..a63ddc46974 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -963,7 +963,8 @@ public abstract class HttpConnection extends AbstractConnection @Override public void startResponse(Buffer version, int status, Buffer reason) { - LOG.debug("Bad request!: "+version+" "+status+" "+reason); + if (LOG.isDebugEnabled()) + LOG.debug("Bad request!: "+version+" "+status+" "+reason); } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 46554a844bc..b6f9f29c1e8 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -793,7 +793,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. @Override public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - LOG.debug("scope {} @ {}",baseRequest.getContextPath() + "|" + baseRequest.getServletPath() + "|" + baseRequest.getPathInfo(),this); + if (LOG.isDebugEnabled()) + LOG.debug("scope {}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(),baseRequest.getPathInfo(),this); Context old_context = null; String old_context_path = null; @@ -865,7 +866,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. } if (LOG.isDebugEnabled()) - LOG.debug("context={} @ {}",baseRequest.getContextPath() + "|" + baseRequest.getServletPath() + "|" + baseRequest.getPathInfo(),this); + LOG.debug("context={}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(), baseRequest.getPathInfo(),this); // start manual inline of nextScope(target,baseRequest,request,response); if (never()) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java index 8712f766a59..f231f8bea10 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java @@ -30,7 +30,7 @@ import org.eclipse.jetty.util.log.Logger; @SuppressWarnings("deprecation") public abstract class AbstractSession implements AbstractSessionManager.SessionIf { - final static Logger __log = SessionHandler.__log; + final static Logger LOG = SessionHandler.LOG; private final AbstractSessionManager _manager; private final String _clusterId; // ID unique within cluster @@ -63,7 +63,8 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI _lastAccessed=_created; _requests=1; _maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000:-1; - __log.debug("new session & id "+_nodeId+" "+_clusterId); + if (LOG.isDebugEnabled()) + LOG.debug("new session & id "+_nodeId+" "+_clusterId); } /* ------------------------------------------------------------- */ @@ -76,7 +77,8 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI _accessed=accessed; _lastAccessed=accessed; _requests=1; - __log.debug("new session "+_nodeId+" "+_clusterId); + if (LOG.isDebugEnabled()) + LOG.debug("new session "+_nodeId+" "+_clusterId); } /* ------------------------------------------------------------- */ @@ -300,7 +302,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI { try { - __log.debug("invalidate ",_clusterId); + LOG.debug("invalidate {}",_clusterId); if (isValid()) clearAttributes(); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionManager.java index 60d1f3de713..b6c1a381668 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionManager.java @@ -56,7 +56,7 @@ import org.eclipse.jetty.util.statistic.SampleStatistic; @SuppressWarnings("deprecation") public abstract class AbstractSessionManager extends AbstractLifeCycle implements SessionManager { - final static Logger __log = SessionHandler.__log; + final static Logger __log = SessionHandler.LOG; /* ------------------------------------------------------------ */ public final static int __distantFuture=60*60*24*7*52*20; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java index c015eb283f0..2cad672343f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java @@ -46,7 +46,7 @@ import org.eclipse.jetty.util.log.Logger; */ public class HashSessionManager extends AbstractSessionManager { - final static Logger __log = SessionHandler.__log; + final static Logger __log = SessionHandler.LOG; protected final ConcurrentMap _sessions=new ConcurrentHashMap(); private static int __id; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java index fd60ea8addc..acfc47f5f3f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java @@ -162,11 +162,8 @@ public class HashedSession extends AbstractSession // Access now to prevent race with idling period access(System.currentTimeMillis()); - if (LOG.isDebugEnabled()) - { LOG.debug("Deidling " + super.getId()); - } FileInputStream fis = null; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java index f9a01d68131..5280023e7d1 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java @@ -53,7 +53,7 @@ import org.eclipse.jetty.util.log.Logger; */ public class JDBCSessionIdManager extends AbstractSessionIdManager { - final static Logger LOG = SessionHandler.__log; + final static Logger LOG = SessionHandler.LOG; protected final HashSet _sessionIds = new HashSet(); protected Server _server; @@ -108,7 +108,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager throws SQLException { _dbName = dbMeta.getDatabaseProductName().toLowerCase(); - LOG.debug ("Using database "+_dbName); + LOG.debug ("Using database {}",_dbName); _isLower = dbMeta.storesLowerCaseIdentifiers(); _isUpper = dbMeta.storesUpperCaseIdentifiers(); } @@ -255,7 +255,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager if ((System.currentTimeMillis()%2) == 0) _scavengeIntervalMs += tenPercent; - if (LOG.isDebugEnabled()) LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms"); + if (LOG.isDebugEnabled()) + LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms"); if (_timer!=null && (period!=old_period || _task==null)) { synchronized (this) @@ -434,7 +435,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager initializeDatabase(); prepareTables(); super.doStart(); - if (LOG.isDebugEnabled()) LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec"); + if (LOG.isDebugEnabled()) + LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec"); _timer=new Timer("JDBCSessionScavenger", true); setScavengeInterval(getScavengeInterval()); } @@ -684,7 +686,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager List expiredSessionIds = new ArrayList(); try { - if (LOG.isDebugEnabled()) LOG.debug("Scavenge sweep started at "+System.currentTimeMillis()); + if (LOG.isDebugEnabled()) + LOG.debug("Scavenge sweep started at "+System.currentTimeMillis()); if (_lastScavengeTime > 0) { connection = getConnection(); @@ -693,7 +696,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager PreparedStatement statement = connection.prepareStatement(_selectExpiredSessions); long lowerBound = (_lastScavengeTime - _scavengeIntervalMs); long upperBound = _lastScavengeTime; - if (LOG.isDebugEnabled()) LOG.debug (" Searching for sessions expired between "+lowerBound + " and "+upperBound); + if (LOG.isDebugEnabled()) + LOG.debug (" Searching for sessions expired between "+lowerBound + " and "+upperBound); statement.setLong(1, lowerBound); statement.setLong(2, upperBound); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java index 0c15fb0df62..f3e1bf57370 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java @@ -375,7 +375,8 @@ public class JDBCSessionManager extends AbstractSessionManager @Override protected void timeout() throws IllegalStateException { - if (LOG.isDebugEnabled()) LOG.debug("Timing out session id="+getClusterId()); + if (LOG.isDebugEnabled()) + LOG.debug("Timing out session id="+getClusterId()); super.timeout(); } } @@ -788,7 +789,8 @@ public class JDBCSessionManager extends AbstractSessionManager while (itor.hasNext()) { String sessionId = (String)itor.next(); - if (LOG.isDebugEnabled()) LOG.debug("Expiring session id "+sessionId); + if (LOG.isDebugEnabled()) + LOG.debug("Expiring session id "+sessionId); Session session = (Session)_sessions.get(sessionId); if (session != null) @@ -798,7 +800,8 @@ public class JDBCSessionManager extends AbstractSessionManager } else { - if (LOG.isDebugEnabled()) LOG.debug("Unrecognized session id="+sessionId); + if (LOG.isDebugEnabled()) + LOG.debug("Unrecognized session id="+sessionId); } } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java index 2e951710c73..a18a6e7553b 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java @@ -36,7 +36,7 @@ import org.eclipse.jetty.util.log.Logger; */ public class SessionHandler extends ScopedHandler { - final static Logger __log = Log.getLogger("org.eclipse.jetty.server.session"); + final static Logger LOG = Log.getLogger("org.eclipse.jetty.server.session"); /* -------------------------------------------------------------- */ private SessionManager _sessionManager; @@ -175,10 +175,10 @@ public class SessionHandler extends ScopedHandler } } - if(__log.isDebugEnabled()) + if(LOG.isDebugEnabled()) { - __log.debug("sessionManager="+_sessionManager); - __log.debug("session="+session); + LOG.debug("sessionManager="+_sessionManager); + LOG.debug("session="+session); } // start manual inline of nextScope(target,baseRequest,request,response); @@ -264,7 +264,8 @@ public class SessionHandler extends ScopedHandler { requested_session_id=cookies[i].getValue(); requested_session_id_from_cookie = true; - if(__log.isDebugEnabled())__log.debug("Got Session ID "+requested_session_id+" from cookie"); + if(LOG.isDebugEnabled()) + LOG.debug("Got Session ID {} from cookie",requested_session_id); session=sessionManager.getHttpSession(requested_session_id); if (session!=null && sessionManager.isValid(session)) @@ -297,8 +298,8 @@ public class SessionHandler extends ScopedHandler requested_session_id = uri.substring(s,i); requested_session_id_from_cookie = false; session=sessionManager.getHttpSession(requested_session_id); - if(__log.isDebugEnabled()) - __log.debug("Got Session ID "+requested_session_id+" from URL"); + if(LOG.isDebugEnabled()) + LOG.debug("Got Session ID {} from URL",requested_session_id); } } } diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java index b6ebf48708f..2b8133f6e76 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java @@ -280,7 +280,8 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory if (h.getServletInstance()==this) _defaultHolder=h; - if (LOG.isDebugEnabled()) LOG.debug("resource base = "+_resourceBase); + if (LOG.isDebugEnabled()) + LOG.debug("resource base = "+_resourceBase); } /** diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java index e1be344bdcf..6ae5b38a164 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java @@ -82,7 +82,8 @@ public class Holder extends AbstractLifeCycle implements Dumpable try { _class=Loader.loadClass(Holder.class, _className); - if(LOG.isDebugEnabled())LOG.debug("Holding {}",_class); + if(LOG.isDebugEnabled()) + LOG.debug("Holding {}",_class); } catch (Exception e) { diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java index 9a378264186..e133f2bb70d 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java @@ -140,7 +140,8 @@ public class Invoker extends HttpServlet { // Found a named servlet (from a user's web.xml file) so // now we add a mapping for it - LOG.debug("Adding servlet mapping for named servlet:"+servlet+":"+URIUtil.addPaths(servlet_path,servlet)+"/*"); + if (LOG.isDebugEnabled()) + LOG.debug("Adding servlet mapping for named servlet:"+servlet+":"+URIUtil.addPaths(servlet_path,servlet)+"/*"); ServletMapping mapping = new ServletMapping(); mapping.setServletName(servlet); mapping.setPathSpec(URIUtil.addPaths(servlet_path,servlet)+"/*"); @@ -174,7 +175,8 @@ public class Invoker extends HttpServlet else { // Make a holder - LOG.debug("Making new servlet="+servlet+" with path="+path+"/*"); + if (LOG.isDebugEnabled()) + LOG.debug("Making new servlet="+servlet+" with path="+path+"/*"); holder=_servletHandler.addServletWithMapping(servlet, path+"/*"); if (_parameters!=null) @@ -211,7 +213,7 @@ public class Invoker extends HttpServlet } } - if (_verbose) + if (_verbose && LOG.isDebugEnabled()) LOG.debug("Dynamic load '"+servlet+"' at "+path); } } diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java index 72de75cf444..59404a827e9 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java @@ -390,7 +390,7 @@ public class ServletHandler extends ScopedHandler } if (LOG.isDebugEnabled()) - LOG.debug("servlet {} -> {}",baseRequest.getContextPath()+"|"+baseRequest.getServletPath()+"|"+baseRequest.getPathInfo(),servlet_holder); + LOG.debug("servlet {}|{}|{} -> {}",baseRequest.getContextPath(),baseRequest.getServletPath(),baseRequest.getPathInfo(),servlet_holder); try { @@ -455,7 +455,7 @@ public class ServletHandler extends ScopedHandler } } - LOG.debug("chain=",chain); + LOG.debug("chain={}",chain); try { @@ -1231,7 +1231,8 @@ public class ServletHandler extends ScopedHandler HttpServletResponse response) throws IOException { - if(LOG.isDebugEnabled())LOG.debug("Not Found "+request.getRequestURI()); + if(LOG.isDebugEnabled()) + LOG.debug("Not Found "+request.getRequestURI()); response.sendError(HttpServletResponse.SC_NOT_FOUND); } @@ -1392,13 +1393,15 @@ public class ServletHandler extends ScopedHandler public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { - if (LOG.isDebugEnabled()) LOG.debug("doFilter " + _filter); + if (LOG.isDebugEnabled()) + LOG.debug("doFilter " + _filter); // pass to next filter if (_filter < LazyList.size(_chain)) { FilterHolder holder= (FilterHolder)LazyList.get(_chain, _filter++); - if (LOG.isDebugEnabled()) LOG.debug("call filter " + holder); + if (LOG.isDebugEnabled()) + LOG.debug("call filter " + holder); Filter filter= holder.getFilter(); if (holder.isAsyncSupported() || !_baseRequest.isAsyncSupported()) @@ -1424,7 +1427,8 @@ public class ServletHandler extends ScopedHandler // Call servlet if (_servletHolder != null) { - if (LOG.isDebugEnabled()) LOG.debug("call servlet " + _servletHolder); + if (LOG.isDebugEnabled()) + LOG.debug("call servlet " + _servletHolder); _servletHolder.handle(_baseRequest,request, response); } else // Not found diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java index e38c73de306..0afce6165c7 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java @@ -74,7 +74,7 @@ import org.eclipse.jetty.util.log.Logger; */ public class CrossOriginFilter implements Filter { - private static final Logger logger = Log.getLogger(CrossOriginFilter.class); + private static final Logger LOG = Log.getLogger(CrossOriginFilter.class); // Request headers private static final String ORIGIN_HEADER = "Origin"; @@ -145,7 +145,7 @@ public class CrossOriginFilter implements Filter } catch (NumberFormatException x) { - logger.info("Cross-origin filter, could not parse '{}' parameter as integer: {}", PREFLIGHT_MAX_AGE_PARAM, preflightMaxAgeConfig); + LOG.info("Cross-origin filter, could not parse '{}' parameter as integer: {}", PREFLIGHT_MAX_AGE_PARAM, preflightMaxAgeConfig); } String allowedCredentialsConfig = config.getInitParameter(ALLOW_CREDENTIALS_PARAM); @@ -153,12 +153,15 @@ public class CrossOriginFilter implements Filter allowedCredentialsConfig = "true"; allowCredentials = Boolean.parseBoolean(allowedCredentialsConfig); - logger.debug("Cross-origin filter configuration: " + - ALLOWED_ORIGINS_PARAM + " = " + allowedOriginsConfig + ", " + - ALLOWED_METHODS_PARAM + " = " + allowedMethodsConfig + ", " + - ALLOWED_HEADERS_PARAM + " = " + allowedHeadersConfig + ", " + - PREFLIGHT_MAX_AGE_PARAM + " = " + preflightMaxAgeConfig + ", " + - ALLOW_CREDENTIALS_PARAM + " = " + allowedCredentialsConfig); + if (LOG.isDebugEnabled()) + { + LOG.debug("Cross-origin filter configuration: " + + ALLOWED_ORIGINS_PARAM + " = " + allowedOriginsConfig + ", " + + ALLOWED_METHODS_PARAM + " = " + allowedMethodsConfig + ", " + + ALLOWED_HEADERS_PARAM + " = " + allowedHeadersConfig + ", " + + PREFLIGHT_MAX_AGE_PARAM + " = " + preflightMaxAgeConfig + ", " + + ALLOW_CREDENTIALS_PARAM + " = " + allowedCredentialsConfig); + } } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException @@ -176,23 +179,23 @@ public class CrossOriginFilter implements Filter { if (isSimpleRequest(request)) { - logger.debug("Cross-origin request to {} is a simple cross-origin request", request.getRequestURI()); + LOG.debug("Cross-origin request to {} is a simple cross-origin request", request.getRequestURI()); handleSimpleResponse(request, response, origin); } else if (isPreflightRequest(request)) { - logger.debug("Cross-origin request to {} is a preflight cross-origin request", request.getRequestURI()); + LOG.debug("Cross-origin request to {} is a preflight cross-origin request", request.getRequestURI()); handlePreflightResponse(request, response, origin); } else { - logger.debug("Cross-origin request to {} is a non-simple cross-origin request", request.getRequestURI()); + LOG.debug("Cross-origin request to {} is a non-simple cross-origin request", request.getRequestURI()); handleSimpleResponse(request, response, origin); } } else { - logger.debug("Cross-origin request to " + request.getRequestURI() + " with origin " + origin + " does not match allowed origins " + allowedOrigins); + LOG.debug("Cross-origin request to " + request.getRequestURI() + " with origin " + origin + " does not match allowed origins " + allowedOrigins); } } @@ -291,18 +294,18 @@ public class CrossOriginFilter implements Filter private boolean isMethodAllowed(HttpServletRequest request) { String accessControlRequestMethod = request.getHeader(ACCESS_CONTROL_REQUEST_METHOD_HEADER); - logger.debug("{} is {}", ACCESS_CONTROL_REQUEST_METHOD_HEADER, accessControlRequestMethod); + LOG.debug("{} is {}", ACCESS_CONTROL_REQUEST_METHOD_HEADER, accessControlRequestMethod); boolean result = false; if (accessControlRequestMethod != null) result = allowedMethods.contains(accessControlRequestMethod); - logger.debug("Method {} is" + (result ? "" : " not") + " among allowed methods {}", accessControlRequestMethod, allowedMethods); + LOG.debug("Method {} is" + (result ? "" : " not") + " among allowed methods {}", accessControlRequestMethod, allowedMethods); return result; } private boolean areHeadersAllowed(HttpServletRequest request) { String accessControlRequestHeaders = request.getHeader(ACCESS_CONTROL_REQUEST_HEADERS_HEADER); - logger.debug("{} is {}", ACCESS_CONTROL_REQUEST_HEADERS_HEADER, accessControlRequestHeaders); + LOG.debug("{} is {}", ACCESS_CONTROL_REQUEST_HEADERS_HEADER, accessControlRequestHeaders); boolean result = true; if (accessControlRequestHeaders != null) { @@ -325,7 +328,7 @@ public class CrossOriginFilter implements Filter } } } - logger.debug("Headers [{}] are" + (result ? "" : " not") + " among allowed headers {}", accessControlRequestHeaders, allowedHeaders); + LOG.debug("Headers [{}] are" + (result ? "" : " not") + " among allowed headers {}", accessControlRequestHeaders, allowedHeaders); return result; } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java index dab77534ae2..b0ef41ce86c 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java @@ -188,7 +188,7 @@ public abstract class AbstractLifeCycle implements LifeCycle private void setStopped() { _state = __STOPPED; - LOG.debug(STOPPED+" {}",this); + LOG.debug("{} {}",STOPPED,this); for (Listener listener : _listeners) listener.lifeCycleStopped(this); } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java index bc9205bdf8c..d53636a1ce5 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AggregateLifeCycle.java @@ -144,7 +144,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable t=(T)o; } } - if (count>1) + if (count>1 && LOG.isDebugEnabled()) LOG.debug("getBean({}) 1 of {}",clazz.getName(),count); return t; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index 95bafcec4d8..d5268540550 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -56,28 +56,28 @@ public class Log }); } - private static Logger __log; + private static Logger LOG; private static boolean __initialized; public static boolean initialized() { - if (__log != null) + if (LOG != null) return true; synchronized (Log.class) { if (__initialized) - return __log != null; + return LOG != null; __initialized = true; } try { Class log_class = Loader.loadClass(Log.class, __logClass); - if (__log == null || !__log.getClass().equals(log_class)) + if (LOG == null || !LOG.getClass().equals(log_class)) { - __log = (Logger)log_class.newInstance(); - __log.debug("Logging to {} via {}", __log, log_class.getName()); + LOG = (Logger)log_class.newInstance(); + LOG.debug("Logging to {} via {}", LOG, log_class.getName()); } } catch(Throwable e) @@ -88,7 +88,7 @@ public class Log initStandardLogging(e); } - return __log != null; + return LOG != null; } private static void initStandardLogging(Throwable e) @@ -96,17 +96,17 @@ public class Log Class log_class; if(e != null && __ignored) e.printStackTrace(); - if (__log == null) + if (LOG == null) { log_class = StdErrLog.class; - __log = new StdErrLog(); - __log.debug("Logging to {} via {}", __log, log_class.getName()); + LOG = new StdErrLog(); + LOG.debug("Logging to {} via {}", LOG, log_class.getName()); } } public static void setLog(Logger log) { - Log.__log = log; + Log.LOG = log; } /** @@ -116,7 +116,7 @@ public class Log public static Logger getLog() { initialized(); - return __log; + return LOG; } /** @@ -125,7 +125,7 @@ public class Log */ public static Logger getRootLogger() { initialized(); - return __log; + return LOG; } static boolean isIgnored() @@ -179,7 +179,7 @@ public class Log { if (!isDebugEnabled()) return; - __log.debug(EXCEPTION, th); + LOG.debug(EXCEPTION, th); } /** @@ -190,7 +190,7 @@ public class Log { if (!initialized()) return; - __log.debug(msg); + LOG.debug(msg); } /** @@ -201,7 +201,7 @@ public class Log { if (!initialized()) return; - __log.debug(msg, arg); + LOG.debug(msg, arg); } /** @@ -212,7 +212,7 @@ public class Log { if (!initialized()) return; - __log.debug(msg, arg0, arg1); + LOG.debug(msg, arg0, arg1); } /** @@ -228,7 +228,7 @@ public class Log { if (!initialized()) return; - __log.ignore(thrown); + LOG.ignore(thrown); } /** @@ -239,7 +239,7 @@ public class Log { if (!initialized()) return; - __log.info(msg); + LOG.info(msg); } /** @@ -250,7 +250,7 @@ public class Log { if (!initialized()) return; - __log.info(msg, arg); + LOG.info(msg, arg); } /** @@ -261,7 +261,7 @@ public class Log { if (!initialized()) return; - __log.info(msg, arg0, arg1); + LOG.info(msg, arg0, arg1); } /** @@ -272,7 +272,7 @@ public class Log { if (!initialized()) return false; - return __log.isDebugEnabled(); + return LOG.isDebugEnabled(); } /** @@ -283,7 +283,7 @@ public class Log { if (!initialized()) return; - __log.warn(msg); + LOG.warn(msg); } /** @@ -294,7 +294,7 @@ public class Log { if (!initialized()) return; - __log.warn(msg, arg); + LOG.warn(msg, arg); } /** @@ -305,7 +305,7 @@ public class Log { if (!initialized()) return; - __log.warn(msg, arg0, arg1); + LOG.warn(msg, arg0, arg1); } /** @@ -316,7 +316,7 @@ public class Log { if (!initialized()) return; - __log.warn(msg, th); + LOG.warn(msg, th); } /** @@ -327,7 +327,7 @@ public class Log { if (!initialized()) return; - __log.warn(EXCEPTION, th); + LOG.warn(EXCEPTION, th); } /** @@ -352,6 +352,6 @@ public class Log if (!initialized()) return null; - return name == null ? __log : __log.getLogger(name); + return name == null ? LOG : LOG.getLogger(name); } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java index e317ec00cd2..a06af65b320 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java @@ -130,7 +130,8 @@ public class JarResource extends URLResource if (!exists()) return; - if(LOG.isDebugEnabled())LOG.debug("Extract "+this+" to "+directory); + if(LOG.isDebugEnabled()) + LOG.debug("Extract "+this+" to "+directory); String urlString = this.getURL().toExternalForm().trim(); int endOfJarUrl = urlString.indexOf("!/"); @@ -143,7 +144,8 @@ public class JarResource extends URLResource String subEntryName = (endOfJarUrl+2 < urlString.length() ? urlString.substring(endOfJarUrl + 2) : null); boolean subEntryIsDir = (subEntryName != null && subEntryName.endsWith("/")?true:false); - if (LOG.isDebugEnabled()) LOG.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL); + if (LOG.isDebugEnabled()) + LOG.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL); InputStream is = jarFileURL.openConnection().getInputStream(); JarInputStream jin = new JarInputStream(is); @@ -194,7 +196,8 @@ public class JarResource extends URLResource if (!shouldExtract) { - if (LOG.isDebugEnabled()) LOG.debug("Skipping entry: "+entryName); + if (LOG.isDebugEnabled()) + LOG.debug("Skipping entry: "+entryName); continue; } @@ -202,7 +205,8 @@ public class JarResource extends URLResource dotCheck = URIUtil.canonicalPath(dotCheck); if (dotCheck == null) { - if (LOG.isDebugEnabled()) LOG.debug("Invalid entry: "+entryName); + if (LOG.isDebugEnabled()) + LOG.debug("Invalid entry: "+entryName); continue; } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ShutdownThread.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ShutdownThread.java index 96c9c2527e8..d0bbce9fe06 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ShutdownThread.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ShutdownThread.java @@ -122,7 +122,7 @@ public class ShutdownThread extends Thread try { lifeCycle.stop(); - LOG.debug("Stopped " + lifeCycle); + LOG.debug("Stopped {}",lifeCycle); } catch (Exception ex) { diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java index d6cc0be137c..57df7945011 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java @@ -54,12 +54,11 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration //cannot configure if the _context is already started if (context.isStarted()) { - if (LOG.isDebugEnabled()){LOG.debug("Cannot configure webapp after it is started");} + LOG.debug("Cannot configure webapp after it is started"); return; } - if(LOG.isDebugEnabled()) - LOG.debug("Configuring web-jetty.xml"); + LOG.debug("Configuring web-jetty.xml"); Resource web_inf = context.getWebInf(); // handle any WEB-INF descriptors @@ -79,9 +78,8 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration try { context.setServerClasses(null); - if(LOG.isDebugEnabled()) { + if(LOG.isDebugEnabled()) LOG.debug("Configure: "+jetty); - } XmlConfiguration jetty_config = (XmlConfiguration)context.getAttribute(XML_CONFIGURATION); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java index c4d327465a6..26cd6df1755 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java @@ -147,7 +147,8 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor break; } } - if (LOG.isDebugEnabled()) LOG.debug("ContextParam: " + name + "=" + value); + if (LOG.isDebugEnabled()) + LOG.debug("ContextParam: " + name + "=" + value); } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java index 863c85c9113..5adda2233a8 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java @@ -437,7 +437,8 @@ public class TagLibConfiguration extends AbstractConfiguration public void visitListener (WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String className=node.getString("listener-class",false,true); - if (LOG.isDebugEnabled()) LOG.debug("listener="+className); + if (LOG.isDebugEnabled()) + LOG.debug("listener="+className); try { diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index 35bc7bb4601..c78eda2cd77 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -401,11 +401,11 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL if (LOG.isDebugEnabled()) { ClassLoader loader = getClassLoader(); - LOG.debug("Thread Context class loader is: " + loader); + LOG.debug("Thread Context classloader {}",loader); loader=loader.getParent(); while(loader!=null) { - LOG.debug("Parent class loader is: " + loader); + LOG.debug("Parent class loader: {} ",loader); loader=loader.getParent(); } } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java index 7507aaceab7..ccad435a463 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebDescriptor.java @@ -198,7 +198,8 @@ public class WebDescriptor extends Descriptor _metaDataComplete = Boolean.valueOf(s).booleanValue()?MetaDataComplete.True:MetaDataComplete.False; } - LOG.debug(_xml.toString()+": Calculated metadatacomplete = " + _metaDataComplete + " with version=" + version); + if (LOG.isDebugEnabled()) + LOG.debug(_xml.toString()+": Calculated metadatacomplete = " + _metaDataComplete + " with version=" + version); } public void processOrdering () diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java index 817f77b5dfa..9495f68a923 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java @@ -125,7 +125,8 @@ public class WebInfConfiguration extends AbstractConfiguration //cannot configure if the context is already started if (context.isStarted()) { - if (LOG.isDebugEnabled()){LOG.debug("Cannot configure webapp "+context+" after it is started");} + if (LOG.isDebugEnabled()) + LOG.debug("Cannot configure webapp "+context+" after it is started"); return; } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebXmlConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebXmlConfiguration.java index a2a362827a3..63b2ae18794 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebXmlConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebXmlConfiguration.java @@ -79,7 +79,7 @@ public class WebXmlConfiguration extends AbstractConfiguration // cannot configure if the context is already started if (context.isStarted()) { - if (LOG.isDebugEnabled()) LOG.debug("Cannot configure webapp after it is started"); + LOG.debug("Cannot configure webapp after it is started"); return; } @@ -102,7 +102,8 @@ public class WebXmlConfiguration extends AbstractConfiguration // do web.xml file Resource web = web_inf.addPath("web.xml"); if (web.exists()) return web; - LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); + if (LOG.isDebugEnabled()) + LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); } return null; }