293739 - Deprecate static Jetty Log usage in favor of named logs

+ Finished conversion of jetty-security, jetty-server, jetty-servlet,
  jetty-servlets, jetty-websocket
This commit is contained in:
Joakim Erdfelt 2011-08-24 12:53:27 -07:00
parent f15617fbb2
commit f7f7e0af75
76 changed files with 616 additions and 388 deletions

View File

@ -29,6 +29,7 @@ import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.Scanner.BulkListener;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
/* ------------------------------------------------------------ */
@ -54,6 +55,8 @@ import org.eclipse.jetty.util.resource.Resource;
*/
public class HashLoginService extends MappedLoginService
{
private static final Logger LOG = Log.getLogger(HashLoginService.class);
private String _config;
private Resource _configResource;
private Scanner _scanner;
@ -135,7 +138,7 @@ public class HashLoginService extends MappedLoginService
return;
_configResource = Resource.newResource(_config);
if (Log.isDebugEnabled()) Log.debug("Load " + this + " from " + _config);
if (LOG.isDebugEnabled()) LOG.debug("Load " + this + " from " + _config);
Properties properties = new Properties();
properties.load(_configResource.getInputStream());
Set<String> known = new HashSet<String>();

View File

@ -27,6 +27,7 @@ import org.eclipse.jetty.http.security.Credential;
import org.eclipse.jetty.server.UserIdentity;
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;
/* ------------------------------------------------------------ */
@ -53,6 +54,8 @@ import org.eclipse.jetty.util.resource.Resource;
public class JDBCLoginService extends MappedLoginService
{
private static final Logger LOG = Log.getLogger(JDBCLoginService.class);
private String _config;
private String _jdbcDriver;
private String _url;
@ -134,7 +137,7 @@ public class JDBCLoginService extends MappedLoginService
|| _password == null
|| _cacheTime < 0)
{
if (Log.isDebugEnabled()) Log.debug("UserRealm " + getName() + " has not been properly configured");
if (LOG.isDebugEnabled()) LOG.debug("UserRealm " + getName() + " has not been properly configured");
}
_cacheTime *= 1000;
_lastHashPurge = 0;
@ -189,11 +192,11 @@ public class JDBCLoginService extends MappedLoginService
}
catch (SQLException e)
{
Log.warn("UserRealm " + getName() + " could not connect to database; will try later", e);
LOG.warn("UserRealm " + getName() + " could not connect to database; will try later", e);
}
catch (ClassNotFoundException e)
{
Log.warn("UserRealm " + getName() + " could not connect to database; will try later", e);
LOG.warn("UserRealm " + getName() + " could not connect to database; will try later", e);
}
}
@ -253,7 +256,7 @@ public class JDBCLoginService extends MappedLoginService
}
catch (SQLException e)
{
Log.warn("UserRealm " + getName() + " could not load user information from database", e);
LOG.warn("UserRealm " + getName() + " could not load user information from database", e);
closeConnection();
}
return null;
@ -266,8 +269,8 @@ public class JDBCLoginService extends MappedLoginService
{
if (_con != null)
{
if (Log.isDebugEnabled()) Log.debug("Closing db connection for JDBCUserRealm");
try { _con.close(); }catch (Exception e) {Log.ignore(e);}
if (LOG.isDebugEnabled()) LOG.debug("Closing db connection for JDBCUserRealm");
try { _con.close(); }catch (Exception e) {LOG.ignore(e);}
}
_con = null;
}

View File

@ -27,6 +27,7 @@ import org.eclipse.jetty.http.security.Credential;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -38,6 +39,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public abstract class MappedLoginService extends AbstractLifeCycle implements LoginService
{
private static final Logger LOG = Log.getLogger(MappedLoginService.class);
protected IdentityService _identityService=new DefaultIdentityService();
protected String _name;
protected final ConcurrentMap<String, UserIdentity> _users=new ConcurrentHashMap<String, UserIdentity>();
@ -129,7 +132,7 @@ public abstract class MappedLoginService extends AbstractLifeCycle implements Lo
/* ------------------------------------------------------------ */
public void logout(UserIdentity identity)
{
Log.debug("logout {}",identity);
LOG.debug("logout {}",identity);
}
/* ------------------------------------------------------------ */

View File

@ -16,6 +16,7 @@ import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.Scanner.BulkListener;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
/**
@ -34,6 +35,8 @@ import org.eclipse.jetty.util.resource.Resource;
*/
public class PropertyUserStore extends AbstractLifeCycle
{
private static final Logger LOG = Log.getLogger(PropertyUserStore.class);
private String _config;
private Resource _configResource;
private Scanner _scanner;
@ -93,8 +96,8 @@ public class PropertyUserStore extends AbstractLifeCycle
if (_config == null)
return;
if (Log.isDebugEnabled())
Log.debug("Load " + this + " from " + _config);
if (LOG.isDebugEnabled())
LOG.debug("Load " + this + " from " + _config);
Properties properties = new Properties();
if (getConfigResource().exists())
properties.load(getConfigResource().getInputStream());

View File

@ -36,6 +36,7 @@ import org.eclipse.jetty.server.handler.ContextHandler.Context;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* Abstract SecurityHandler.
@ -53,6 +54,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public abstract class SecurityHandler extends HandlerWrapper implements Authenticator.AuthConfiguration
{
private static final Logger LOG = Log.getLogger(SecurityHandler.class);
/* ------------------------------------------------------------ */
private boolean _checkWelcomeFiles = false;
private Authenticator _authenticator;
@ -326,7 +329,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
{
if (_realmName!=null)
{
Log.warn("No ServerAuthentication for "+this);
LOG.warn("No ServerAuthentication for "+this);
throw new IllegalStateException("No ServerAuthentication");
}
}
@ -532,7 +535,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
/* ------------------------------------------------------------ */
public void logout(Authentication.User user)
{
Log.debug("logout {}",user);
LOG.debug("logout {}",user);
LoginService login_service=getLoginService();
if (login_service!=null)
{

View File

@ -24,6 +24,7 @@ import org.eclipse.jetty.http.security.B64Code;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.ietf.jgss.GSSContext;
import org.ietf.jgss.GSSCredential;
@ -34,6 +35,8 @@ import org.ietf.jgss.Oid;
public class SpnegoLoginService extends AbstractLifeCycle implements LoginService
{
private static final Logger LOG = Log.getLogger(SpnegoLoginService.class);
protected IdentityService _identityService;// = new LdapIdentityService();
protected String _name;
private String _config;
@ -97,7 +100,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
_targetName = properties.getProperty("targetName");
Log.debug("\n\nTarget Name\n\n" + _targetName);
LOG.debug("\n\nTarget Name\n\n" + _targetName);
super.doStart();
}
@ -121,7 +124,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
if (gContext == null)
{
Log.debug("SpnegoUserRealm: failed to establish GSSContext");
LOG.debug("SpnegoUserRealm: failed to establish GSSContext");
}
else
{
@ -134,10 +137,10 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
String clientName = gContext.getSrcName().toString();
String role = clientName.substring(clientName.indexOf('@') + 1);
Log.debug("SpnegoUserRealm: established a security context");
Log.debug("Client Principal is: " + gContext.getSrcName());
Log.debug("Server Principal is: " + gContext.getTargName());
Log.debug("Client Default Role: " + role);
LOG.debug("SpnegoUserRealm: established a security context");
LOG.debug("Client Principal is: " + gContext.getSrcName());
LOG.debug("Server Principal is: " + gContext.getTargName());
LOG.debug("Client Default Role: " + role);
SpnegoUserPrincipal user = new SpnegoUserPrincipal(clientName,authToken);
@ -151,7 +154,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
}
catch (GSSException gsse)
{
Log.warn(gsse);
LOG.warn(gsse);
}
return null;

View File

@ -33,9 +33,12 @@ import org.eclipse.jetty.server.Authentication;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class DeferredAuthentication implements Authentication.Deferred
{
private static final Logger LOG = Log.getLogger(DeferredAuthentication.class);
protected final Authenticator _authenticator;
private LoginService _loginService;
@ -108,7 +111,7 @@ public class DeferredAuthentication implements Authentication.Deferred
}
catch (ServerAuthException e)
{
Log.debug(e);
LOG.debug(e);
}
return Authentication.UNAUTHENTICATED;
}
@ -128,7 +131,7 @@ public class DeferredAuthentication implements Authentication.Deferred
}
catch (ServerAuthException e)
{
Log.debug(e);
LOG.debug(e);
}
return Authentication.UNAUTHENTICATED;
}

View File

@ -37,6 +37,7 @@ import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* @version $Rev: 4793 $ $Date: 2009-03-19 00:00:01 +0100 (Thu, 19 Mar 2009) $
@ -46,6 +47,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class DigestAuthenticator extends LoginAuthenticator
{
private static final Logger LOG = Log.getLogger(DigestAuthenticator.class);
protected long _maxNonceAge = 0;
protected long _nonceSecret = this.hashCode() ^ System.currentTimeMillis();
protected boolean _useStale = false;
@ -93,7 +96,7 @@ 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;
@ -206,7 +209,7 @@ public class DigestAuthenticator extends LoginAuthenticator
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
for (int i = 0; i < hash.length; i++)
@ -243,7 +246,7 @@ public class DigestAuthenticator extends LoginAuthenticator
}
long age = request.getTimeStamp() - ts;
if (Log.isDebugEnabled()) Log.debug("age=" + age);
if (LOG.isDebugEnabled()) LOG.debug("age=" + age);
byte[] hash = null;
try
@ -255,7 +258,7 @@ public class DigestAuthenticator extends LoginAuthenticator
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
for (int i = 0; i < 16; i++)
@ -267,7 +270,7 @@ public class DigestAuthenticator extends LoginAuthenticator
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return -1;
}
@ -352,7 +355,7 @@ public class DigestAuthenticator extends LoginAuthenticator
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
return false;

View File

@ -43,6 +43,7 @@ import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* FORM Authenticator.
@ -61,6 +62,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class FormAuthenticator extends LoginAuthenticator
{
private static final Logger LOG = Log.getLogger(FormAuthenticator.class);
public final static String __FORM_LOGIN_PAGE="org.eclipse.jetty.security.form_login_page";
public final static String __FORM_ERROR_PAGE="org.eclipse.jetty.security.form_error_page";
public final static String __FORM_DISPATCH="org.eclipse.jetty.security.dispatch";
@ -120,7 +123,7 @@ public class FormAuthenticator extends LoginAuthenticator
{
if (!path.startsWith("/"))
{
Log.warn("form-login-page must start with /");
LOG.warn("form-login-page must start with /");
path = "/" + path;
}
_formLoginPage = path;
@ -141,7 +144,7 @@ public class FormAuthenticator extends LoginAuthenticator
{
if (!path.startsWith("/"))
{
Log.warn("form-error-page must start with /");
LOG.warn("form-error-page must start with /");
path = "/" + path;
}
_formErrorPage = path;
@ -205,8 +208,8 @@ public class FormAuthenticator extends LoginAuthenticator
}
// not authenticated
if (Log.isDebugEnabled())
Log.debug("Form authentication FAILED for " + StringUtil.printable(username));
if (LOG.isDebugEnabled())
LOG.debug("Form authentication FAILED for " + StringUtil.printable(username));
if (_formErrorPage == null)
{
if (response != null)

View File

@ -34,9 +34,12 @@ import org.eclipse.jetty.server.Authentication;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.server.UserIdentity.Scope;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class SessionAuthentication implements Authentication.User, Serializable, HttpSessionActivationListener, HttpSessionBindingListener
{
private static final Logger LOG = Log.getLogger(SessionAuthentication.class);
private static final long serialVersionUID = -4643200685888258706L;
@ -86,7 +89,7 @@ public class SessionAuthentication implements Authentication.User, Serializable,
throw new IllegalStateException("!LoginService");
_userIdentity=login_service.login(_name,_credentials);
Log.debug("Deserialized and relogged in {}",this);
LOG.debug("Deserialized and relogged in {}",this);
}
public void logout()

View File

@ -30,9 +30,12 @@ import org.eclipse.jetty.server.Authentication;
import org.eclipse.jetty.server.Authentication.User;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class SpnegoAuthenticator extends LoginAuthenticator
{
{
private static final Logger LOG = Log.getLogger(SpnegoAuthenticator.class);
public String getAuthMethod()
{
return Constraint.__SPNEGO_AUTH;
@ -60,7 +63,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator
return Authentication.UNAUTHENTICATED;
}
Log.debug("SpengoAuthenticator: sending challenge");
LOG.debug("SpengoAuthenticator: sending challenge");
res.setHeader(HttpHeaders.WWW_AUTHENTICATE, HttpHeaders.NEGOTIATE);
res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return Authentication.SEND_CONTINUE;

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.statistic.CounterStatistic;
import org.eclipse.jetty.util.statistic.SampleStatistic;
import org.eclipse.jetty.util.thread.ThreadPool;
@ -52,6 +53,8 @@ import org.eclipse.jetty.util.thread.ThreadPool;
*/
public abstract class AbstractConnector extends HttpBuffers implements Connector, Dumpable
{
private static final Logger LOG = Log.getLogger(AbstractConnector.class);
private String _name;
private Server _server;
@ -272,7 +275,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
public void setAcceptors(int acceptors)
{
if (acceptors > 2 * Runtime.getRuntime().availableProcessors())
Log.warn("Acceptors should be <=2*availableProcessors: " + this);
LOG.warn("Acceptors should be <=2*availableProcessors: " + this);
_acceptors = acceptors;
}
@ -311,10 +314,10 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
for (int i = 0; i < _acceptorThread.length; i++)
_threadPool.dispatch(new Acceptor(i));
if (_threadPool.isLowOnThreads())
Log.warn("insufficient threads configured for {}",this);
LOG.warn("insufficient threads configured for {}",this);
}
Log.info("Started {}",this);
LOG.info("Started {}",this);
}
/* ------------------------------------------------------------ */
@ -327,7 +330,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
}
catch (IOException e)
{
Log.warn(e);
LOG.warn(e);
}
if (_threadPool != _server.getThreadPool() && _threadPool instanceof LifeCycle)
@ -375,7 +378,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
@ -449,7 +452,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
}
catch (UnknownHostException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
@ -631,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(this + " is forwarded");
_forwarded = check;
}
@ -831,16 +834,16 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
}
catch (EofException e)
{
Log.ignore(e);
LOG.ignore(e);
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
catch (InterruptedException x)
{
// Connector has been stopped
Log.ignore(x);
LOG.ignore(x);
}
catch (ThreadDeath e)
{
@ -848,7 +851,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
}
catch (Throwable e)
{
Log.warn(e);
LOG.warn(e);
}
}
}
@ -998,7 +1001,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
if (on && _statsStartedAt.get() != -1)
return;
Log.debug("Statistics on = " + on + " for " + this);
LOG.debug("Statistics on = " + on + " for " + this);
statsReset();
_statsStartedAt.set(on?System.currentTimeMillis():-1);

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandler.Context;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.Timeout;
/* ------------------------------------------------------------ */
@ -36,6 +37,8 @@ import org.eclipse.jetty.util.thread.Timeout;
*/
public class AsyncContinuation implements AsyncContext, Continuation
{
private static final Logger LOG = Log.getLogger(AsyncContinuation.class);
private final static long DEFAULT_TIMEOUT=30000L;
private final static ContinuationThrowable __exception = new ContinuationThrowable();
@ -402,7 +405,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
}
catch(Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}
@ -490,7 +493,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
}
catch(Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}
@ -560,7 +563,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
}
catch (InterruptedException e)
{
Log.ignore(e);
LOG.ignore(e);
}
wait=_expireAt-System.currentTimeMillis();
}
@ -835,7 +838,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
{
if (isSuspended())
{
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
throw new ContinuationThrowable();
else
throw __exception;

View File

@ -8,9 +8,12 @@ import org.eclipse.jetty.io.AsyncEndPoint;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class AsyncHttpConnection extends HttpConnection
{
private static final Logger LOG = Log.getLogger(AsyncHttpConnection.class);
public AsyncHttpConnection(Connector connector, EndPoint endpoint, Server server)
{
super(connector,endpoint,server);
@ -33,7 +36,7 @@ public class AsyncHttpConnection extends HttpConnection
progress=false;
try
{
Log.debug("async request",_request);
LOG.debug("async request",_request);
// Handle resumed request
if (_request._async.isAsync() && !_request._async.isComplete())
@ -53,11 +56,11 @@ public class AsyncHttpConnection extends HttpConnection
}
catch (HttpException e)
{
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("uri="+_uri);
Log.debug("fields="+_requestFields);
Log.debug(e);
LOG.debug("uri="+_uri);
LOG.debug("fields="+_requestFields);
LOG.debug(e);
}
_generator.sendError(e.getStatus(), e.getReason(), null, true);
_parser.reset();
@ -68,7 +71,7 @@ public class AsyncHttpConnection extends HttpConnection
// Do we need to complete a half close?
if (_endp.isInputShutdown() && (_parser.isIdle() || _parser.isComplete()))
{
Log.debug("complete half close {}",this);
LOG.debug("complete half close {}",this);
more_in_buffer=false;
_endp.close();
reset(true);
@ -99,7 +102,7 @@ public class AsyncHttpConnection extends HttpConnection
// else Are we suspended?
else if (_request.isAsyncStarted())
{
Log.debug("suspended {}",this);
LOG.debug("suspended {}",this);
more_in_buffer=false;
progress=false;
}

View File

@ -10,9 +10,12 @@ import org.eclipse.jetty.io.AsyncEndPoint;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class BlockingHttpConnection extends HttpConnection
{
private static final Logger LOG = Log.getLogger(BlockingHttpConnection.class);
private volatile boolean _handling;
public BlockingHttpConnection(Connector connector, EndPoint endpoint, Server server)
@ -66,11 +69,11 @@ public class BlockingHttpConnection extends HttpConnection
}
catch (HttpException e)
{
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("uri="+_uri);
Log.debug("fields="+_requestFields);
Log.debug(e);
LOG.debug("uri="+_uri);
LOG.debug("fields="+_requestFields);
LOG.debug(e);
}
_generator.sendError(e.getStatus(), e.getReason(), null, true);

View File

@ -17,6 +17,7 @@ import javax.servlet.http.Cookie;
import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
@ -31,6 +32,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class CookieCutter
{
private static final Logger LOG = Log.getLogger(CookieCutter.class);
private Cookie[] _cookies;
private Cookie[] _lastCookies;
@ -309,8 +312,8 @@ public class CookieCutter
}
catch (Exception e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
}
name = null;

View File

@ -54,6 +54,7 @@ import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
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.util.thread.Timeout;
@ -90,6 +91,8 @@ import org.eclipse.jetty.util.thread.Timeout;
*/
public abstract class HttpConnection extends AbstractConnection
{
private static final Logger LOG = Log.getLogger(HttpConnection.class);
private static final int UNKNOWN = -2;
private static final ThreadLocal<HttpConnection> __currentConnection = new ThreadLocal<HttpConnection>();
@ -398,7 +401,7 @@ public abstract class HttpConnection extends AbstractConnection
String threadName=null;
try
{
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
threadName=Thread.currentThread().getName();
Thread.currentThread().setName(threadName+" - "+_uri);
@ -445,23 +448,23 @@ public abstract class HttpConnection extends AbstractConnection
}
catch (ContinuationThrowable e)
{
Log.ignore(e);
LOG.ignore(e);
}
catch (EofException e)
{
Log.debug(e);
LOG.debug(e);
_request.setHandled(true);
error=true;
}
catch (RuntimeIOException e)
{
Log.debug(e);
LOG.debug(e);
_request.setHandled(true);
error=true;
}
catch (HttpException e)
{
Log.debug(e);
LOG.debug(e);
_request.setHandled(true);
_response.sendError(e.getStatus(), e.getReason());
error=true;
@ -472,7 +475,7 @@ public abstract class HttpConnection extends AbstractConnection
throw (ThreadDeath)e;
error=true;
Log.warn(String.valueOf(_uri),e);
LOG.warn(String.valueOf(_uri),e);
_request.setHandled(true);
_generator.sendError(info==null?400:500, null, null, true);
}
@ -493,7 +496,7 @@ public abstract class HttpConnection extends AbstractConnection
if (_expect100Continue)
{
Log.debug("100 continues not sent");
LOG.debug("100 continues not sent");
// We didn't send 100 continues, but the latest interpretation
// of the spec (see httpbis) is that the client will either
// send the body anyway, or close. So we no longer need to
@ -549,7 +552,7 @@ public abstract class HttpConnection extends AbstractConnection
}
catch(RuntimeException e)
{
Log.warn("header full: "+e);
LOG.warn("header full: "+e);
_response.reset();
_generator.reset(true);
@ -580,8 +583,8 @@ public abstract class HttpConnection extends AbstractConnection
}
catch(RuntimeException e)
{
Log.warn("header full: "+e);
Log.debug(e);
LOG.warn("header full: "+e);
LOG.debug(e);
_response.reset();
_generator.reset(true);
@ -653,7 +656,7 @@ public abstract class HttpConnection extends AbstractConnection
/* ------------------------------------------------------------ */
public void closed()
{
Log.debug("closed {}",this);
LOG.debug("closed {}",this);
}
/* ------------------------------------------------------------ */
@ -732,7 +735,7 @@ public abstract class HttpConnection extends AbstractConnection
}
catch (Exception e)
{
Log.debug(e);
LOG.debug(e);
if (e instanceof HttpException)
throw (HttpException)e;
throw new HttpException(HttpStatus.BAD_REQUEST_400,null,e);
@ -945,7 +948,7 @@ public abstract class HttpConnection extends AbstractConnection
@Override
public void startResponse(Buffer version, int status, Buffer reason)
{
Log.debug("Bad request!: "+version+" "+status+" "+reason);
LOG.debug("Bad request!: "+version+" "+status+" "+reason);
}
}

View File

@ -19,6 +19,7 @@ import java.util.StringTokenizer;
import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** Byte range inclusive of end points.
@ -43,6 +44,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class InclusiveByteRange
{
private static final Logger LOG = Log.getLogger(InclusiveByteRange.class);
long first = 0;
long last = 0;
@ -97,7 +100,7 @@ public class InclusiveByteRange
{
if ("bytes".equals(t))
continue;
Log.warn("Bad range format: {}",t);
LOG.warn("Bad range format: {}",t);
continue headers;
}
else if (d == 0)
@ -106,7 +109,7 @@ public class InclusiveByteRange
last = Long.parseLong(t.substring(d + 1).trim());
else
{
Log.warn("Bad range format: {}",t);
LOG.warn("Bad range format: {}",t);
continue;
}
}
@ -132,16 +135,16 @@ public class InclusiveByteRange
}
catch (NumberFormatException e)
{
Log.warn("Bad range format: {}",t);
Log.ignore(e);
LOG.warn("Bad range format: {}",t);
LOG.ignore(e);
continue;
}
}
}
catch(Exception e)
{
Log.warn("Bad range format: {}",t);
Log.ignore(e);
LOG.warn("Bad range format: {}",t);
LOG.ignore(e);
}
}
return LazyList.getList(satRanges,true);

View File

@ -29,6 +29,7 @@ import org.eclipse.jetty.util.RolloverFileOutputStream;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* This {@link RequestLog} implementation outputs logs in the pseudo-standard
@ -46,6 +47,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
{
private static final Logger LOG = Log.getLogger(NCSARequestLog.class);
private String _filename;
private boolean _extended;
private boolean _append;
@ -580,7 +583,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
}
catch (IOException e)
{
Log.warn(e);
LOG.warn(e);
}
}
@ -638,7 +641,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
{
_fileOut = new RolloverFileOutputStream(_filename,_append,_retainDays,TimeZone.getTimeZone(_logTimeZone),_filenameDateFormat,null);
_closeOut = true;
Log.info("Opened " + getDatedFilename());
LOG.info("Opened " + getDatedFilename());
}
else
_fileOut = System.err;
@ -677,7 +680,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
if (_out != null && _closeOut)
try
@ -686,7 +689,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
_out = null;

View File

@ -69,6 +69,7 @@ import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.UrlEncoded;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** Jetty Request.
@ -103,6 +104,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class Request implements HttpServletRequest
{
private static final Logger LOG = Log.getLogger(Request.class);
private static final String __ASYNC_FWD="org.eclipse.asyncfwd";
private static final Collection __defaultLocale = Collections.singleton(Locale.getDefault());
private static final int __NONE=0, _STREAM=1, __READER=2;
@ -212,10 +215,10 @@ public class Request implements HttpServletRequest
}
catch (UnsupportedEncodingException e)
{
if (Log.isDebugEnabled())
Log.warn(e);
if (LOG.isDebugEnabled())
LOG.warn(e);
else
Log.warn(e.toString());
LOG.warn(e.toString());
}
}
}
@ -257,10 +260,10 @@ public class Request implements HttpServletRequest
}
catch (IOException e)
{
if (Log.isDebugEnabled())
Log.warn(e);
if (LOG.isDebugEnabled())
LOG.warn(e);
else
Log.warn(e.toString());
LOG.warn(e.toString());
}
}
}
@ -1027,7 +1030,7 @@ public class Request implements HttpServletRequest
}
catch (java.net.UnknownHostException e)
{
Log.ignore(e);
LOG.ignore(e);
}
return _serverName;
}
@ -1333,7 +1336,7 @@ public class Request implements HttpServletRequest
}
catch(Exception e)
{
Log.ignore(e);
LOG.ignore(e);
_reader=null;
}
}

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.io.View;
import org.eclipse.jetty.io.nio.DirectNIOBuffer;
import org.eclipse.jetty.io.nio.IndirectNIOBuffer;
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.util.resource.ResourceFactory;
@ -43,6 +44,8 @@ import org.eclipse.jetty.util.resource.ResourceFactory;
*/
public class ResourceCache
{
private static final Logger LOG = Log.getLogger(ResourceCache.class);
private final ConcurrentMap<String,Content> _cache;
private final AtomicInteger _cachedSize;
private final AtomicInteger _cachedFiles;
@ -290,7 +293,7 @@ public class ResourceCache
int len=(int)resource.length();
if (len<0)
{
Log.warn("invalid resource: "+String.valueOf(resource)+" "+len);
LOG.warn("invalid resource: "+String.valueOf(resource)+" "+len);
return null;
}
Buffer buffer = new IndirectNIOBuffer(len);
@ -301,7 +304,7 @@ public class ResourceCache
}
catch(IOException e)
{
Log.warn(e);
LOG.warn(e);
return null;
}
}
@ -317,7 +320,7 @@ public class ResourceCache
int len=(int)resource.length();
if (len<0)
{
Log.warn("invalid resource: "+String.valueOf(resource)+" "+len);
LOG.warn("invalid resource: "+String.valueOf(resource)+" "+len);
return null;
}
Buffer buffer = new DirectNIOBuffer(len);
@ -328,7 +331,7 @@ public class ResourceCache
}
catch(IOException e)
{
Log.warn(e);
LOG.warn(e);
return null;
}
}
@ -448,7 +451,7 @@ public class ResourceCache
Buffer buffer2=ResourceCache.this.getIndirectBuffer(_resource);
if (buffer2==null)
Log.warn("Could not load "+this);
LOG.warn("Could not load "+this);
else if (_indirectBuffer.compareAndSet(null,buffer2))
buffer=buffer2;
else
@ -469,7 +472,7 @@ public class ResourceCache
Buffer buffer2=ResourceCache.this.getDirectBuffer(_resource);
if (buffer2==null)
Log.warn("Could not load "+this);
LOG.warn("Could not load "+this);
else if (_directBuffer.compareAndSet(null,buffer2))
buffer=buffer2;
else

View File

@ -42,6 +42,7 @@ import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/** Response.
* <p>
@ -50,6 +51,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class Response implements HttpServletResponse
{
private static final Logger LOG = Log.getLogger(Response.class);
public static final int
NONE=0,
STREAM=1,
@ -268,7 +271,7 @@ public class Response implements HttpServletResponse
return;
if (isCommitted())
Log.warn("Committed before "+code+" "+message);
LOG.warn("Committed before "+code+" "+message);
resetBuffer();
_characterEncoding=null;

View File

@ -35,6 +35,7 @@ import org.eclipse.jetty.util.component.Container;
import org.eclipse.jetty.util.component.Destroyable;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ShutdownThread;
import org.eclipse.jetty.util.thread.ThreadPool;
@ -50,6 +51,8 @@ import org.eclipse.jetty.util.thread.ThreadPool;
*/
public class Server extends HandlerWrapper implements Attributes
{
private static final Logger LOG = Log.getLogger(Server.class);
private static final String __version;
static
{
@ -246,7 +249,7 @@ public class Server extends HandlerWrapper implements Attributes
if (getStopAtShutdown())
ShutdownThread.register(this);
Log.info("jetty-"+__version);
LOG.info("jetty-"+__version);
HttpGenerator.setServerVersion(__version);
MultiException mex=new MultiException();
@ -295,7 +298,7 @@ public class Server extends HandlerWrapper implements Attributes
{
for (int i=_connectors.length;i-->0;)
{
Log.info("Graceful shutdown {}",_connectors[i]);
LOG.info("Graceful shutdown {}",_connectors[i]);
try{_connectors[i].close();}catch(Throwable e){mex.add(e);}
}
}
@ -304,7 +307,7 @@ public class Server extends HandlerWrapper implements Attributes
for (int c=0;c<contexts.length;c++)
{
Graceful context=(Graceful)contexts[c];
Log.info("Graceful shutdown {}",context);
LOG.info("Graceful shutdown {}",context);
context.setShutdown(true);
}
Thread.sleep(_graceful);
@ -336,11 +339,11 @@ public class Server extends HandlerWrapper implements Attributes
final Request request=connection.getRequest();
final Response response=connection.getResponse();
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("REQUEST "+target+" on "+connection);
LOG.debug("REQUEST "+target+" on "+connection);
handle(target, request, request, response);
Log.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
}
else
handle(target, request, request, response);
@ -381,11 +384,11 @@ public class Server extends HandlerWrapper implements Attributes
final HttpServletRequest request=(HttpServletRequest)async.getRequest();
final HttpServletResponse response=(HttpServletResponse)async.getResponse();
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("REQUEST "+target+" on "+connection);
LOG.debug("REQUEST "+target+" on "+connection);
handle(target, baseRequest, request, response);
Log.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
}
else
handle(target, baseRequest, request, response);

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.server.BlockingHttpConnection;
import org.eclipse.jetty.server.HttpConnection;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------------------------- */
@ -49,6 +50,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class SocketConnector extends AbstractConnector
{
private static final Logger LOG = Log.getLogger(SocketConnector.class);
protected ServerSocket _serverSocket;
protected final Set<EndPoint> _connections;
protected volatile int _localPort=-1;
@ -199,7 +202,7 @@ public class SocketConnector extends AbstractConnector
{
if (getThreadPool()==null || !getThreadPool().dispatch(this))
{
Log.warn("dispatch failed for {}",_connection);
LOG.warn("dispatch failed for {}",_connection);
close();
}
}
@ -244,21 +247,21 @@ public class SocketConnector extends AbstractConnector
}
catch (EofException e)
{
Log.debug("EOF", e);
LOG.debug("EOF", e);
try{close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
catch (HttpException e)
{
Log.debug("BAD", e);
LOG.debug("BAD", e);
try{close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
catch(Exception e)
{
Log.warn("handle failed?",e);
LOG.warn("handle failed?",e);
try{close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
finally
{
@ -289,7 +292,7 @@ public class SocketConnector extends AbstractConnector
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
}

View File

@ -20,6 +20,7 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
@ -29,6 +30,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public abstract class AbstractHandler extends AggregateLifeCycle implements Handler
{
private static final Logger LOG = Log.getLogger(AbstractHandler.class);
private Server _server;
/* ------------------------------------------------------------ */
@ -46,7 +49,7 @@ public abstract class AbstractHandler extends AggregateLifeCycle implements Hand
@Override
protected void doStart() throws Exception
{
Log.debug("starting {}",this);
LOG.debug("starting {}",this);
super.doStart();
}
@ -57,7 +60,7 @@ public abstract class AbstractHandler extends AggregateLifeCycle implements Hand
@Override
protected void doStop() throws Exception
{
Log.debug("stopping {}",this);
LOG.debug("stopping {}",this);
super.doStop();
}

View File

@ -32,6 +32,7 @@ import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.ThreadPool;
/**
@ -41,6 +42,8 @@ import org.eclipse.jetty.util.thread.ThreadPool;
*/
public class ConnectHandler extends HandlerWrapper
{
private static final Logger LOG = Log.getLogger(ConnectHandler.class);
private final Logger _logger = Log.getLogger(getClass().getName());
private final SelectorManager _selectorManager = new Manager();
private volatile int _connectTimeout = 5000;
@ -232,7 +235,7 @@ public class ConnectHandler extends HandlerWrapper
if (!validateDestination(host))
{
Log.info("ProxyHandler: Forbidden destination " + host);
LOG.info("ProxyHandler: Forbidden destination " + host);
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
baseRequest.setHandled(true);
return;
@ -356,7 +359,7 @@ public class ConnectHandler extends HandlerWrapper
}
catch (IOException xx)
{
Log.ignore(xx);
LOG.ignore(xx);
}
throw x;
}
@ -679,7 +682,7 @@ public class ConnectHandler extends HandlerWrapper
}
catch(Exception e)
{
Log.debug(e);
LOG.debug(e);
close();
}
}
@ -841,7 +844,7 @@ public class ConnectHandler extends HandlerWrapper
}
catch(Exception e)
{
Log.debug(e);
LOG.debug(e);
close();
}
}

View File

@ -65,6 +65,7 @@ import org.eclipse.jetty.util.component.AggregateLifeCycle;
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;
import org.eclipse.jetty.util.resource.Resource;
/* ------------------------------------------------------------ */
@ -81,6 +82,8 @@ import org.eclipse.jetty.util.resource.Resource;
*/
public class ContextHandler extends ScopedHandler implements Attributes, Server.Graceful
{
private static final Logger LOG = Log.getLogger(ContextHandler.class);
private static final ThreadLocal<Context> __context = new ThreadLocal<Context>();
/**
@ -369,7 +372,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (IOException e)
{
Log.debug(e);
LOG.debug(e);
}
}
if (classpath.length() == 0)
@ -641,7 +644,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
}
Log.info("started {}",this);
LOG.info("started {}",this);
}
/* ------------------------------------------------------------ */
@ -692,7 +695,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
finally
{
Log.info("stopped {}",this);
LOG.info("stopped {}",this);
__context.set(old_context);
// reset the classloader
if (_classLoader != null)
@ -790,7 +793,7 @@ 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);
LOG.debug("scope {} @ {}",baseRequest.getContextPath() + "|" + baseRequest.getServletPath() + "|" + baseRequest.getPathInfo(),this);
Context old_context = null;
String old_context_path = null;
@ -861,8 +864,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
baseRequest.setPathInfo(pathInfo);
}
if (Log.isDebugEnabled())
Log.debug("context={} @ {}",baseRequest.getContextPath() + "|" + baseRequest.getServletPath() + "|" + baseRequest.getPathInfo(),this);
if (LOG.isDebugEnabled())
LOG.debug("context={} @ {}",baseRequest.getContextPath() + "|" + baseRequest.getServletPath() + "|" + baseRequest.getPathInfo(),this);
// start manual inline of nextScope(target,baseRequest,request,response);
if (never())
@ -941,7 +944,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (HttpException e)
{
Log.debug(e);
LOG.debug(e);
baseRequest.setHandled(true);
response.sendError(e.getStatus(),e.getReason());
}
@ -1163,8 +1166,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (Exception e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
throw new IllegalArgumentException(resourceBase);
}
}
@ -1374,11 +1377,11 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
if (!_aliases && resource.getAlias() != null)
{
if (resource.exists())
Log.warn("Aliased resource: " + resource + "~=" + resource.getAlias());
LOG.warn("Aliased resource: " + resource + "~=" + resource.getAlias());
else if (path.endsWith("/") && resource.getAlias().toString().endsWith(path))
return resource;
else if (Log.isDebugEnabled())
Log.debug("Aliased resource: " + resource + "~=" + resource.getAlias());
else if (LOG.isDebugEnabled())
LOG.debug("Aliased resource: " + resource + "~=" + resource.getAlias());
return null;
}
@ -1386,7 +1389,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return null;
@ -1443,7 +1446,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return Collections.emptySet();
}
@ -1640,7 +1643,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return null;
}
@ -1670,7 +1673,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return null;
@ -1700,7 +1703,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
return null;
}
}

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.server.HandlerContainer;
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;
/* ------------------------------------------------------------ */
/** ContextHandlerCollection.
@ -42,7 +43,9 @@ import org.eclipse.jetty.util.log.Log;
* @org.apache.xbean.XBean element="contexts"
*/
public class ContextHandlerCollection extends HandlerCollection
{
{
private static final Logger LOG = Log.getLogger(ContextHandlerCollection.class);
private volatile PathMap _contextMap;
private Class<? extends ContextHandler> _contextClass = ContextHandler.class;
@ -281,7 +284,7 @@ public class ContextHandlerCollection extends HandlerCollection
}
catch (Exception e)
{
Log.debug(e);
LOG.debug(e);
throw new Error(e);
}
}

View File

@ -31,6 +31,7 @@ import org.eclipse.jetty.util.ByteArrayISO8859Writer;
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;
/* ------------------------------------------------------------ */
@ -47,6 +48,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class DefaultHandler extends AbstractHandler
{
private static final Logger LOG = Log.getLogger(DefaultHandler.class);
final long _faviconModified=(System.currentTimeMillis()/1000)*1000;
byte[] _favicon;
boolean _serveIcon=true;
@ -62,7 +65,7 @@ public class DefaultHandler extends AbstractHandler
}
catch(Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.http.HttpMethods;
import org.eclipse.jetty.http.gzip.GzipResponseWrapper;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -53,6 +54,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class GzipHandler extends HandlerWrapper
{
private static final Logger LOG = Log.getLogger(GzipHandler.class);
protected Set<String> _mimeTypes;
protected Set<String> _excluded;
protected int _bufferSize = 8192;
@ -242,7 +245,7 @@ public class GzipHandler extends HandlerWrapper
}
catch(IOException e)
{
Log.warn(e);
LOG.warn(e);
}
}

View File

@ -29,6 +29,7 @@ import org.eclipse.jetty.server.HttpConnection;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.IPAddressMap;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
@ -93,6 +94,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class IPAccessHandler extends HandlerWrapper
{
private static final Logger LOG = Log.getLogger(IPAccessHandler.class);
IPAddressMap<PathMap> _white = new IPAddressMap<PathMap>();
IPAddressMap<PathMap> _black = new IPAddressMap<PathMap>();
@ -238,7 +241,7 @@ public class IPAccessHandler extends HandlerWrapper
pathMap.put(path,path);
if (deprecated)
Log.debug(toString() +" - deprecated specification syntax: "+entry);
LOG.debug(toString() +" - deprecated specification syntax: "+entry);
}
}
@ -326,7 +329,7 @@ public class IPAccessHandler extends HandlerWrapper
{
super.doStart();
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
System.err.println(dump());
}

View File

@ -26,6 +26,7 @@ import org.eclipse.jetty.server.RequestLog;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -38,6 +39,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class RequestLogHandler extends HandlerWrapper
{
private static final Logger LOG = Log.getLogger(RequestLogHandler.class);
private RequestLog _requestLog;
/* ------------------------------------------------------------ */
@ -79,7 +82,7 @@ public class RequestLogHandler extends HandlerWrapper
}
catch (Exception e)
{
Log.warn (e);
LOG.warn (e);
}
if (getServer()!=null)

View File

@ -35,6 +35,7 @@ import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.handler.ContextHandler.Context;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.FileResource;
import org.eclipse.jetty.util.resource.Resource;
@ -51,6 +52,8 @@ import org.eclipse.jetty.util.resource.Resource;
*/
public class ResourceHandler extends AbstractHandler
{
private static final Logger LOG = Log.getLogger(ResourceHandler.class);
ContextHandler _context;
Resource _baseResource;
Resource _defaultStylesheet;
@ -180,8 +183,8 @@ public class ResourceHandler extends AbstractHandler
}
catch (Exception e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
throw new IllegalArgumentException(resourceBase);
}
}
@ -206,8 +209,8 @@ public class ResourceHandler extends AbstractHandler
}
catch(IOException e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
}
}
return _defaultStylesheet;
@ -225,14 +228,14 @@ public class ResourceHandler extends AbstractHandler
_stylesheet = Resource.newResource(stylesheet);
if(!_stylesheet.exists())
{
Log.warn("unable to find custom stylesheet: " + stylesheet);
LOG.warn("unable to find custom stylesheet: " + stylesheet);
_stylesheet = null;
}
}
catch(Exception e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
throw new IllegalArgumentException(stylesheet.toString());
}
}
@ -280,7 +283,7 @@ public class ResourceHandler extends AbstractHandler
}
catch(Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return null;
@ -352,7 +355,7 @@ public class ResourceHandler extends AbstractHandler
if (!_aliases && resource.getAlias()!=null)
{
Log.info(resource+" aliased to "+resource.getAlias());
LOG.info(resource+" aliased to "+resource.getAlias());
return;
}

View File

@ -24,9 +24,12 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.AbstractHandlerContainer;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class AbstractHandlerMBean extends ObjectMBean
{
private static final Logger LOG = Log.getLogger(AbstractHandlerMBean.class);
/* ------------------------------------------------------------ */
public AbstractHandlerMBean(Object managedObject)
{
@ -106,7 +109,7 @@ public class AbstractHandlerMBean extends ObjectMBean
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
name=context.getBaseResource().getName();
}
}

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.server.HttpConnection;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.ConcurrentHashSet;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------------------------- */
@ -49,6 +50,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class BlockingChannelConnector extends AbstractNIOConnector
{
private static final Logger LOG = Log.getLogger(BlockingChannelConnector.class);
private transient ServerSocketChannel _acceptChannel;
private final Set<BlockingChannelEndPoint> _endpoints = new ConcurrentHashSet<BlockingChannelEndPoint>();
@ -93,11 +96,11 @@ public class BlockingChannelConnector extends AbstractNIOConnector
}
catch(InterruptedException e)
{
Log.ignore(e);
LOG.ignore(e);
}
catch(Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}
@ -209,7 +212,7 @@ public class BlockingChannelConnector extends AbstractNIOConnector
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
@ -218,7 +221,7 @@ public class BlockingChannelConnector extends AbstractNIOConnector
{
if (!getThreadPool().dispatch(this))
{
Log.warn("dispatch failed for {}",_connection);
LOG.warn("dispatch failed for {}",_connection);
BlockingChannelEndPoint.this.close();
}
}
@ -293,21 +296,21 @@ public class BlockingChannelConnector extends AbstractNIOConnector
}
catch (EofException e)
{
Log.debug("EOF", e);
LOG.debug("EOF", e);
try{BlockingChannelEndPoint.this.close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
catch (HttpException e)
{
Log.debug("BAD", e);
LOG.debug("BAD", e);
try{BlockingChannelEndPoint.this.close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
catch(Throwable e)
{
Log.warn("handle failed",e);
LOG.warn("handle failed",e);
try{BlockingChannelEndPoint.this.close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
finally
{
@ -335,7 +338,7 @@ public class BlockingChannelConnector extends AbstractNIOConnector
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
}

View File

@ -18,6 +18,7 @@ import java.nio.channels.Channel;
import java.nio.channels.ServerSocketChannel;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* An implementation of the SelectChannelConnector which first tries to
@ -37,6 +38,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class InheritedChannelConnector extends SelectChannelConnector
{
private static final Logger LOG = Log.getLogger(InheritedChannelConnector.class);
/* ------------------------------------------------------------ */
@Override
public void open() throws IOException
@ -49,14 +52,14 @@ public class InheritedChannelConnector extends SelectChannelConnector
if ( channel instanceof ServerSocketChannel )
_acceptChannel = (ServerSocketChannel)channel;
else
Log.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
if ( _acceptChannel != null )
_acceptChannel.configureBlocking(false);
}
catch(NoSuchMethodError e)
{
Log.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
}
if (_acceptChannel == null)

View File

@ -35,6 +35,7 @@ import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.Timeout.Task;
/* ------------------------------------------------------------------------------- */
@ -65,6 +66,8 @@ import org.eclipse.jetty.util.thread.Timeout.Task;
*/
public class SelectChannelConnector extends AbstractNIOConnector
{
private static final Logger LOG = Log.getLogger(SelectChannelConnector.class);
protected ServerSocketChannel _acceptChannel;
private int _lowResourcesConnections;
private int _lowResourcesMaxIdleTime;
@ -263,11 +266,11 @@ public class SelectChannelConnector extends AbstractNIOConnector
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
catch(Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}
@ -297,7 +300,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}

View File

@ -21,9 +21,12 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.server.SessionIdManager;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public abstract class AbstractSessionIdManager extends AbstractLifeCycle implements SessionIdManager
{
private static final Logger LOG = Log.getLogger(AbstractSessionIdManager.class);
private final static String __NEW_SESSION_ID="org.eclipse.jetty.server.newSessionId";
protected Random _random;
@ -164,7 +167,7 @@ public abstract class AbstractSessionIdManager extends AbstractLifeCycle impleme
}
catch (Exception e)
{
Log.warn("Could not generate SecureRandom for session-id randomness",e);
LOG.warn("Could not generate SecureRandom for session-id randomness",e);
_random=new Random();
_weakRandom=true;
}

View File

@ -14,9 +14,12 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
class HashedSession extends AbstractSession
{
private static final Logger LOG = Log.getLogger(HashedSession.class);
private final HashSessionManager _hashSessionManager;
/** Whether the session has been saved because it has been deemed idle;
@ -83,8 +86,8 @@ class HashedSession extends AbstractSession
// Only idle the session if not already idled and no previous save/idle has failed
if (!isIdled() && !_saveFailed)
{
if (Log.isDebugEnabled())
Log.debug("Saving {} {}",super.getId(),reactivate);
if (LOG.isDebugEnabled())
LOG.debug("Saving {} {}",super.getId(),reactivate);
File file = null;
FileOutputStream fos = null;
@ -108,7 +111,7 @@ class HashedSession extends AbstractSession
{
saveFailed(); // We won't try again for this session
Log.warn("Problem saving session " + super.getId(), e);
LOG.warn("Problem saving session " + super.getId(), e);
if (fos != null)
{
@ -160,9 +163,9 @@ class HashedSession extends AbstractSession
access(System.currentTimeMillis());
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("Deidling " + super.getId());
LOG.debug("Deidling " + super.getId());
}
FileInputStream fis = null;
@ -185,7 +188,7 @@ class HashedSession extends AbstractSession
}
catch (Exception e)
{
Log.warn("Problem deidling session " + super.getId(), e);
LOG.warn("Problem deidling session " + super.getId(), e);
IO.close(fis);
invalidate();
}

View File

@ -38,6 +38,7 @@ import javax.servlet.http.HttpSessionListener;
import org.eclipse.jetty.server.SessionIdManager;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* JDBCSessionManager
@ -64,7 +65,9 @@ import org.eclipse.jetty.util.log.Log;
* field.
*/
public class JDBCSessionManager extends AbstractSessionManager
{
{
private static final Logger LOG = Log.getLogger(JDBCSessionManager.class);
protected String __insertSession;
protected String __deleteSession;
protected String __selectSession;
@ -361,7 +364,7 @@ public class JDBCSessionManager extends AbstractSessionManager
}
catch (Exception e)
{
Log.warn("Problem persisting changed session data id="+getId(), e);
LOG.warn("Problem persisting changed session data id="+getId(), e);
}
finally
{
@ -372,7 +375,7 @@ 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();
}
}
@ -496,15 +499,15 @@ public class JDBCSessionManager extends AbstractSessionManager
//sessions to the same node, changing only iff that node fails.
SessionData data = null;
long now = System.currentTimeMillis();
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
if (session==null)
Log.debug("getSession("+idInCluster+"): not in session map,"+
LOG.debug("getSession("+idInCluster+"): not in session map,"+
" now="+now+
" lastSaved="+(session==null?0:session._data._lastSaved)+
" interval="+(_saveIntervalSec * 1000));
else
Log.debug("getSession("+idInCluster+"): in session map, "+
LOG.debug("getSession("+idInCluster+"): in session map, "+
" now="+now+
" lastSaved="+(session==null?0:session._data._lastSaved)+
" interval="+(_saveIntervalSec * 1000)+
@ -515,17 +518,17 @@ public class JDBCSessionManager extends AbstractSessionManager
if (session==null || ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000)))
{
Log.debug("getSession("+idInCluster+"): no session in session map or stale session. Reloading session data from db.");
LOG.debug("getSession("+idInCluster+"): no session in session map or stale session. Reloading session data from db.");
data = loadSession(idInCluster, canonicalize(_context.getContextPath()), getVirtualHost(_context));
}
else if ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000))
{
Log.debug("getSession("+idInCluster+"): stale session. Reloading session data from db.");
LOG.debug("getSession("+idInCluster+"): stale session. Reloading session data from db.");
data = loadSession(idInCluster, canonicalize(_context.getContextPath()), getVirtualHost(_context));
}
else
{
Log.debug("getSession("+idInCluster+"): session in session map");
LOG.debug("getSession("+idInCluster+"): session in session map");
data = session._data;
}
@ -536,7 +539,7 @@ public class JDBCSessionManager extends AbstractSessionManager
//if the session has no expiry, or it is not already expired
if (data._expiryTime <= 0 || data._expiryTime > now)
{
Log.debug("getSession("+idInCluster+"): lastNode="+data.getLastNode()+" thisNode="+getSessionIdManager().getWorkerName());
LOG.debug("getSession("+idInCluster+"): lastNode="+data.getLastNode()+" thisNode="+getSessionIdManager().getWorkerName());
data.setLastNode(getSessionIdManager().getWorkerName());
//session last used on a different node, or we don't have it in memory
session = new Session(now,data);
@ -547,25 +550,25 @@ public class JDBCSessionManager extends AbstractSessionManager
updateSessionNode(data);
}
else
if (Log.isDebugEnabled()) Log.debug("getSession("+idInCluster+"): Session has expired");
if (LOG.isDebugEnabled()) LOG.debug("getSession("+idInCluster+"): Session has expired");
}
else
if (Log.isDebugEnabled()) Log.debug("getSession("+idInCluster+"): Session not stale "+session._data);
if (LOG.isDebugEnabled()) LOG.debug("getSession("+idInCluster+"): Session not stale "+session._data);
//session in db shares same id, but is not for this context
}
else
{
//No session in db with matching id and context path.
session=null;
if (Log.isDebugEnabled()) Log.debug("getSession("+idInCluster+"): No session in database matching id="+idInCluster);
if (LOG.isDebugEnabled()) LOG.debug("getSession("+idInCluster+"): No session in database matching id="+idInCluster);
}
return session;
}
catch (Exception e)
{
Log.warn("Unable to load session from database", e);
LOG.warn("Unable to load session from database", e);
return null;
}
}
@ -670,7 +673,7 @@ public class JDBCSessionManager extends AbstractSessionManager
}
catch (Exception e)
{
Log.warn("Problem deleting session id="+idInCluster, e);
LOG.warn("Problem deleting session id="+idInCluster, e);
}
return session!=null;
}
@ -703,7 +706,7 @@ public class JDBCSessionManager extends AbstractSessionManager
}
catch (Exception e)
{
Log.warn("Unable to store new session id="+session.getId() , e);
LOG.warn("Unable to store new session id="+session.getId() , e);
}
}
@ -785,7 +788,7 @@ 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)
@ -795,7 +798,7 @@ public class JDBCSessionManager extends AbstractSessionManager
}
else
{
if (Log.isDebugEnabled()) Log.debug("Unrecognized session id="+sessionId);
if (LOG.isDebugEnabled()) LOG.debug("Unrecognized session id="+sessionId);
}
}
}
@ -804,7 +807,7 @@ public class JDBCSessionManager extends AbstractSessionManager
if (t instanceof ThreadDeath)
throw ((ThreadDeath)t);
else
Log.warn("Problem expiring sessions", t);
LOG.warn("Problem expiring sessions", t);
}
finally
{
@ -884,8 +887,8 @@ public class JDBCSessionManager extends AbstractSessionManager
data.setAttributeMap((Map<String,Object>)o);
ois.close();
if (Log.isDebugEnabled())
Log.debug("LOADED session "+data);
if (LOG.isDebugEnabled())
LOG.debug("LOADED session "+data);
}
_reference.set(data);
}
@ -898,7 +901,7 @@ public class JDBCSessionManager extends AbstractSessionManager
if (connection!=null)
{
try { connection.close();}
catch(Exception e) { Log.warn(e); }
catch(Exception e) { LOG.warn(e); }
}
}
}
@ -962,8 +965,8 @@ public class JDBCSessionManager extends AbstractSessionManager
data.setLastSaved(now);
if (Log.isDebugEnabled())
Log.debug("Stored session "+data);
if (LOG.isDebugEnabled())
LOG.debug("Stored session "+data);
}
finally
{
@ -1009,8 +1012,8 @@ public class JDBCSessionManager extends AbstractSessionManager
statement.executeUpdate();
data.setLastSaved(now);
if (Log.isDebugEnabled())
Log.debug("Updated session "+data);
if (LOG.isDebugEnabled())
LOG.debug("Updated session "+data);
}
finally
{
@ -1040,8 +1043,8 @@ public class JDBCSessionManager extends AbstractSessionManager
statement.setString(2, data.getRowId());
statement.executeUpdate();
statement.close();
if (Log.isDebugEnabled())
Log.debug("Updated last node for session id="+data.getId()+", lastNode = "+nodeId);
if (LOG.isDebugEnabled())
LOG.debug("Updated last node for session id="+data.getId()+", lastNode = "+nodeId);
}
finally
{
@ -1075,8 +1078,8 @@ public class JDBCSessionManager extends AbstractSessionManager
statement.executeUpdate();
data.setLastSaved(now);
statement.close();
if (Log.isDebugEnabled())
Log.debug("Updated access time session id="+data.getId());
if (LOG.isDebugEnabled())
LOG.debug("Updated access time session id="+data.getId());
}
finally
{
@ -1106,8 +1109,8 @@ public class JDBCSessionManager extends AbstractSessionManager
statement = connection.prepareStatement(__deleteSession);
statement.setString(1, data.getRowId());
statement.executeUpdate();
if (Log.isDebugEnabled())
Log.debug("Deleted Session "+data);
if (LOG.isDebugEnabled())
LOG.debug("Deleted Session "+data);
}
finally
{

View File

@ -14,9 +14,12 @@ import org.eclipse.jetty.io.bio.SocketEndPoint;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class SslCertificates
{
private static final Logger LOG = Log.getLogger(SslCertificates.class);
/**
* The name of the SSLSession attribute that will contain any cached information.
*/
@ -49,7 +52,7 @@ public class SslCertificates
}
catch (Exception e)
{
Log.warn(Log.EXCEPTION,e);
LOG.warn(Log.EXCEPTION,e);
return null;
}
}
@ -118,7 +121,7 @@ public class SslCertificates
}
catch (Exception e)
{
Log.warn(Log.EXCEPTION,e);
LOG.warn(Log.EXCEPTION,e);
}
}

View File

@ -34,6 +34,7 @@ import org.eclipse.jetty.io.bio.SocketEndPoint;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.bio.SocketConnector;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -52,6 +53,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class SslSocketConnector extends SocketConnector implements SslConnector
{
private static final Logger LOG = Log.getLogger(SslSocketConnector.class);
private final SslContextFactory _sslContextFactory;
private int _handshakeTimeout = 0; //0 means use maxIdleTime
@ -648,8 +651,8 @@ public class SslSocketConnector extends SocketConnector implements SslConnector
{
if (!_sslContextFactory.isAllowRenegotiate())
{
Log.warn("SSL renegotiate denied: "+ssl);
try{ssl.close();}catch(IOException e){Log.warn(e);}
LOG.warn("SSL renegotiate denied: "+ssl);
try{ssl.close();}catch(IOException e){LOG.warn(e);}
}
}
else
@ -665,15 +668,15 @@ public class SslSocketConnector extends SocketConnector implements SslConnector
}
catch (SSLException e)
{
Log.debug(e);
LOG.debug(e);
try{close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
catch (IOException e)
{
Log.debug(e);
LOG.debug(e);
try{close();}
catch(IOException e2){Log.ignore(e2);}
catch(IOException e2){LOG.ignore(e2);}
}
}
}

View File

@ -29,6 +29,7 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@ -39,6 +40,8 @@ import static org.junit.Assert.assertTrue;
public class AbstractConnectorTest
{
private static final Logger LOG = Log.getLogger(AbstractConnectorTest.class);
private static Server _server;
private static AbstractConnector _connector;
private static CyclicBarrier _connect;
@ -76,7 +79,7 @@ public class AbstractConnectorTest
}
catch (Exception ex)
{
Log.debug(ex);
LOG.debug(ex);
}
finally
{

View File

@ -34,6 +34,7 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.toolchain.test.Stress;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.After;
import org.junit.Before;
@ -41,6 +42,8 @@ import org.junit.Test;
public class AsyncStressTest
{
private static final Logger LOG = Log.getLogger(AsyncStressTest.class);
protected Server _server = new Server();
protected SuspendHandler _handler = new SuspendHandler();
protected SelectChannelConnector _connector;
@ -107,7 +110,7 @@ public class AsyncStressTest
System.err.print('+');
}
System.err.println();
Log.info("Bound "+connections);
LOG.info("Bound "+connections);
for (int l=0;l<loops;l++)
{
@ -136,7 +139,7 @@ public class AsyncStressTest
}
System.err.println();
Log.info("Sent "+(loops*__paths.length)+" requests");
LOG.info("Sent "+(loops*__paths.length)+" requests");
String[] results=new String[connections];
for (int i=0;i<connections;i++)
@ -148,7 +151,7 @@ public class AsyncStressTest
}
System.err.println();
Log.info("Read "+connections+" connections");
LOG.info("Read "+connections+" connections");
for (int i=0;i<connections;i++)
{
@ -244,7 +247,7 @@ public class AsyncStressTest
System.err.println(uri+"=="+br.getUri());
System.err.println(asyncContext+"=="+br.getAsyncContinuation());
Log.warn(e);
LOG.warn(e);
System.exit(1);
}
}

View File

@ -15,11 +15,14 @@ package org.eclipse.jetty.server;
import org.eclipse.jetty.server.nio.BlockingChannelConnector;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.BeforeClass;
import org.junit.Test;
public class BlockingChannelTimeoutTest extends ConnectorTimeoutTest
{
private static final Logger LOG = Log.getLogger(BlockingChannelTimeoutTest.class);
@BeforeClass
public static void init() throws Exception
@ -33,6 +36,6 @@ public class BlockingChannelTimeoutTest extends ConnectorTimeoutTest
public void testMaxIdleWithWait() throws Exception
{
// TODO
Log.warn("skipped BlockingChannelTimeoutTest#testMaxIdleWithWait");
LOG.warn("skipped BlockingChannelTimeoutTest#testMaxIdleWithWait");
}
}

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** Dump request handler.
@ -44,6 +45,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class DumpHandler extends AbstractHandler
{
private static final Logger LOG = Log.getLogger(DumpHandler.class);
String label="Dump HttpHandler";
public DumpHandler()
@ -227,7 +230,7 @@ public class DumpHandler extends AbstractHandler
}
catch(Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
}

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StdErrLog;
import org.junit.After;
import org.junit.Before;
@ -43,6 +44,8 @@ import org.junit.Test;
*/
public class HttpConnectionTest
{
private static final Logger LOG = Log.getLogger(HttpConnectionTest.class);
private Server server;
private LocalConnector connector;
@ -333,7 +336,7 @@ public class HttpConnectionTest
Logger logger=null;
try
{
if (!Log.isDebugEnabled())
if (!LOG.isDebugEnabled())
{
logger=Log.getLog();
Log.setLog(null);
@ -456,8 +459,8 @@ public class HttpConnectionTest
}
catch(Exception e)
{
Log.debug(e);
Log.info("correctly ignored "+e);
LOG.debug(e);
LOG.info("correctly ignored "+e);
}
}
});

View File

@ -35,6 +35,7 @@ import org.eclipse.jetty.toolchain.test.Stress;
import org.eclipse.jetty.util.BlockingArrayQueue;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.AfterClass;
import org.junit.Before;
@ -43,6 +44,8 @@ import org.junit.Test;
public class StressTest
{
private static final Logger LOG = Log.getLogger(StressTest.class);
private static QueuedThreadPool _threads;
private static Server _server;
private static SelectChannelConnector _connector;
@ -228,7 +231,7 @@ public class StressTest
else
same=0;
last=status;
Log.info(_server.getThreadPool().toString()+" "+status);
LOG.info(_server.getThreadPool().toString()+" "+status);
if ((finished+errors)== threadCount)
break;
}

View File

@ -30,10 +30,13 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.Test;
public class SslRenegotiateTest
{
private static final Logger LOG = Log.getLogger(SslRenegotiateTest.class);
private static final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager()
{
public java.security.cert.X509Certificate[] getAcceptedIssuers()
@ -168,7 +171,7 @@ public class SslRenegotiateTest
if (!(e instanceof SSLProtocolException))
{
if (reneg)
Log.warn(e);
LOG.warn(e);
assertFalse(reneg);
}
}

View File

@ -53,6 +53,7 @@ import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.MultiPartOutputStream;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.FileResource;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
@ -131,6 +132,8 @@ import org.eclipse.jetty.util.resource.ResourceFactory;
*/
public class DefaultServlet extends HttpServlet implements ResourceFactory
{
private static final Logger LOG = Log.getLogger(DefaultServlet.class);
private static final long serialVersionUID = 4930458713846881193L;
private ServletContext _servletContext;
private ContextHandler _contextHandler;
@ -205,7 +208,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
try{_resourceBase=_contextHandler.newResource(rb);}
catch (Exception e)
{
Log.warn(Log.EXCEPTION,e);
LOG.warn(Log.EXCEPTION,e);
throw new UnavailableException(e.toString());
}
}
@ -218,7 +221,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
_stylesheet = Resource.newResource(css);
if(!_stylesheet.exists())
{
Log.warn("!" + css);
LOG.warn("!" + css);
_stylesheet = null;
}
}
@ -229,8 +232,8 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
}
catch(Exception e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
}
String t=getInitParameter("cacheControl");
@ -244,12 +247,12 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
if (resourceCache!=null)
{
if (max_cache_size!=-1 || max_cached_file_size!= -2 || max_cached_files!=-2)
Log.debug("ignoring resource cache configuration, using resourceCache attribute");
LOG.debug("ignoring resource cache configuration, using resourceCache attribute");
if (_relativeResourceBase!=null || _resourceBase!=null)
throw new UnavailableException("resourceCache specified with resource bases");
_cache=(ResourceCache)_servletContext.getAttribute(resourceCache);
Log.debug("Cache {}={}",resourceCache,_cache);
LOG.debug("Cache {}={}",resourceCache,_cache);
}
try
@ -268,7 +271,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
}
catch (Exception e)
{
Log.warn(Log.EXCEPTION,e);
LOG.warn(Log.EXCEPTION,e);
throw new UnavailableException(e.toString());
}
@ -277,7 +280,7 @@ 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);
}
/**
@ -363,12 +366,12 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
r = _contextHandler.newResource(u);
}
if (Log.isDebugEnabled())
Log.debug("Resource "+pathInContext+"="+r);
if (LOG.isDebugEnabled())
LOG.debug("Resource "+pathInContext+"="+r);
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
if((r==null || !r.exists()) && pathInContext.endsWith("/jetty-dir.css"))
@ -461,8 +464,8 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
}
}
if (Log.isDebugEnabled())
Log.debug("uri="+request.getRequestURI()+" resource="+resource+(content!=null?" content":""));
if (LOG.isDebugEnabled())
LOG.debug("uri="+request.getRequestURI()+" resource="+resource+(content!=null?" content":""));
// Handle resource
if (resource==null || !resource.exists())
@ -527,7 +530,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
// else look for a welcome file
else if (null!=(welcome=getWelcomeFile(pathInContext)))
{
Log.debug("welcome={}",welcome);
LOG.debug("welcome={}",welcome);
if (_redirectWelcome)
{
// Redirect to the index
@ -564,7 +567,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
}
catch(IllegalArgumentException e)
{
Log.warn(Log.EXCEPTION,e);
LOG.warn(Log.EXCEPTION,e);
if(!response.isCommitted())
response.sendError(500, e.getMessage());
}

View File

@ -30,6 +30,7 @@ import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** Error Page Error Handler
@ -40,6 +41,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class ErrorPageErrorHandler extends ErrorHandler
{
private static final Logger LOG = Log.getLogger(ErrorPageErrorHandler.class);
public final static String ERROR_PAGE="org.eclipse.jetty.server.error_page";
protected ServletContext _servletContext;
@ -129,12 +132,12 @@ public class ErrorPageErrorHandler extends ErrorHandler
}
else
{
Log.warn("No error page "+error_page);
LOG.warn("No error page "+error_page);
}
}
catch (ServletException e)
{
Log.warn(Log.EXCEPTION, e);
LOG.warn(Log.EXCEPTION, e);
return;
}
}

View File

@ -27,13 +27,16 @@ import javax.servlet.ServletException;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* --------------------------------------------------------------------- */
/**
*
*/
public class FilterHolder extends Holder<Filter>
{
{
private static final Logger LOG = Log.getLogger(FilterHolder.class);
/* ------------------------------------------------------------ */
private transient Filter _filter;
private transient Config _config;
@ -112,7 +115,7 @@ public class FilterHolder extends Holder<Filter>
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
if (!_extInstance)

View File

@ -31,6 +31,7 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* --------------------------------------------------------------------- */
@ -39,6 +40,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class Holder<T> extends AbstractLifeCycle implements Dumpable
{
private static final Logger LOG = Log.getLogger(Holder.class);
protected transient Class<? extends T> _class;
protected final Map<String,String> _initParams=new HashMap<String,String>(3);
protected String _className;
@ -79,11 +82,11 @@ public class Holder<T> 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)
{
Log.warn(e);
LOG.warn(e);
throw new UnavailableException(e.getMessage(), -1);
}
}
@ -304,8 +307,8 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
public void setDescription(String description)
{
if (Log.isDebugEnabled())
Log.debug(this+" is "+description);
if (LOG.isDebugEnabled())
LOG.debug(this+" is "+description);
}
public String getClassName()

View File

@ -35,6 +35,7 @@ import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** Dynamic Servlet Invoker.
@ -60,6 +61,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class Invoker extends HttpServlet
{
private static final Logger LOG = Log.getLogger(Invoker.class);
private ContextHandler _contextHandler;
private ServletHandler _servletHandler;
@ -137,7 +140,7 @@ 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)+"/*");
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)+"/*");
@ -171,7 +174,7 @@ public class Invoker extends HttpServlet
else
{
// Make a holder
Log.debug("Making new servlet="+servlet+" with path="+path+"/*");
LOG.debug("Making new servlet="+servlet+" with path="+path+"/*");
holder=_servletHandler.addServletWithMapping(servlet, path+"/*");
if (_parameters!=null)
@ -180,7 +183,7 @@ public class Invoker extends HttpServlet
try {holder.start();}
catch (Exception e)
{
Log.debug(e);
LOG.debug(e);
throw new UnavailableException(e.toString());
}
@ -198,10 +201,10 @@ public class Invoker extends HttpServlet
}
catch (Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
Log.warn("Dynamic servlet "+s+
LOG.warn("Dynamic servlet "+s+
" not loaded from context "+
request.getContextPath());
throw new UnavailableException("Not in context");
@ -209,7 +212,7 @@ public class Invoker extends HttpServlet
}
if (_verbose)
Log.debug("Dynamic load '"+servlet+"' at "+path);
LOG.debug("Dynamic load '"+servlet+"' at "+path);
}
}
}
@ -223,7 +226,7 @@ public class Invoker extends HttpServlet
}
else
{
Log.info("Can't find holder for servlet: "+servlet);
LOG.info("Can't find holder for servlet: "+servlet);
response.sendError(404);
}

View File

@ -61,6 +61,7 @@ import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* --------------------------------------------------------------------- */
/** Servlet HttpHandler.
@ -76,6 +77,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class ServletHandler extends ScopedHandler
{
private static final Logger LOG = Log.getLogger(ServletHandler.class);
/* ------------------------------------------------------------ */
public static final String __DEFAULT_SERVLET="default";
@ -187,7 +190,7 @@ public class ServletHandler extends ScopedHandler
{
for (int i=_filters.length; i-->0;)
{
try { _filters[i].stop(); }catch(Exception e){Log.warn(Log.EXCEPTION,e);}
try { _filters[i].stop(); }catch(Exception e){LOG.warn(Log.EXCEPTION,e);}
}
}
@ -196,7 +199,7 @@ public class ServletHandler extends ScopedHandler
{
for (int i=_servlets.length; i-->0;)
{
try { _servlets[i].stop(); }catch(Exception e){Log.warn(Log.EXCEPTION,e);}
try { _servlets[i].stop(); }catch(Exception e){LOG.warn(Log.EXCEPTION,e);}
}
}
@ -283,7 +286,7 @@ public class ServletHandler extends ScopedHandler
}
catch(Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return null;
}
@ -386,8 +389,8 @@ public class ServletHandler extends ScopedHandler
servlet_holder=(ServletHolder)_servletNameMap.get(target);
}
if (Log.isDebugEnabled())
Log.debug("servlet {} -> {}",baseRequest.getContextPath()+"|"+baseRequest.getServletPath()+"|"+baseRequest.getPathInfo(),servlet_holder);
if (LOG.isDebugEnabled())
LOG.debug("servlet {} -> {}",baseRequest.getContextPath()+"|"+baseRequest.getServletPath()+"|"+baseRequest.getPathInfo(),servlet_holder);
try
{
@ -452,7 +455,7 @@ public class ServletHandler extends ScopedHandler
}
}
Log.debug("chain=",chain);
LOG.debug("chain=",chain);
try
{
@ -506,18 +509,18 @@ public class ServletHandler extends ScopedHandler
Throwable th=e;
if (th instanceof UnavailableException)
{
Log.debug(th);
LOG.debug(th);
}
else if (th instanceof ServletException)
{
Log.debug(th);
LOG.debug(th);
Throwable cause=((ServletException)th).getRootCause();
if (cause!=null)
th=cause;
}
else if (th instanceof RuntimeIOException)
{
Log.debug(th);
LOG.debug(th);
Throwable cause=(IOException)((RuntimeIOException)th).getCause();
if (cause!=null)
th=cause;
@ -531,18 +534,18 @@ public class ServletHandler extends ScopedHandler
else if (th instanceof EofException)
throw (EofException)th;
else if (Log.isDebugEnabled())
else if (LOG.isDebugEnabled())
{
Log.warn(request.getRequestURI(), th);
Log.debug(request.toString());
LOG.warn(request.getRequestURI(), th);
LOG.debug(request.toString());
}
else if (th instanceof IOException || th instanceof UnavailableException)
{
Log.debug(request.getRequestURI(),th);
LOG.debug(request.getRequestURI(),th);
}
else
{
Log.warn(request.getRequestURI(),th);
LOG.warn(request.getRequestURI(),th);
}
if (!response.isCommitted())
@ -561,14 +564,14 @@ public class ServletHandler extends ScopedHandler
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,th.getMessage());
}
else
Log.debug("Response already committed for handling "+th);
LOG.debug("Response already committed for handling "+th);
}
catch(Error e)
{
if (!(DispatcherType.REQUEST.equals(type) || DispatcherType.ASYNC.equals(type)))
throw e;
Log.warn("Error for "+request.getRequestURI(),e);
if(Log.isDebugEnabled())Log.debug(request.toString());
LOG.warn("Error for "+request.getRequestURI(),e);
if(LOG.isDebugEnabled())LOG.debug(request.toString());
// TODO httpResponse.getHttpConnection().forceClose();
if (!response.isCommitted())
@ -578,7 +581,7 @@ public class ServletHandler extends ScopedHandler
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,e.getMessage());
}
else
Log.debug("Response already committed for handling ",e);
LOG.debug("Response already committed for handling ",e);
}
}
@ -766,7 +769,7 @@ public class ServletHandler extends ScopedHandler
}
catch(Throwable e)
{
Log.debug(Log.EXCEPTION,e);
LOG.debug(Log.EXCEPTION,e);
mx.add(e);
}
}
@ -1200,13 +1203,13 @@ public class ServletHandler extends ScopedHandler
}
}
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("filterNameMap="+_filterNameMap);
Log.debug("pathFilters="+_filterPathMappings);
Log.debug("servletFilterMap="+_filterNameMappings);
Log.debug("servletPathMap="+_servletPathMap);
Log.debug("servletNameMap="+_servletNameMap);
LOG.debug("filterNameMap="+_filterNameMap);
LOG.debug("pathFilters="+_filterPathMappings);
LOG.debug("servletFilterMap="+_filterNameMappings);
LOG.debug("servletPathMap="+_servletPathMap);
LOG.debug("servletNameMap="+_servletNameMap);
}
try
@ -1225,7 +1228,7 @@ 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);
}
@ -1316,8 +1319,8 @@ public class ServletHandler extends ScopedHandler
// pass to next filter
if (_filterHolder!=null)
{
if (Log.isDebugEnabled())
Log.debug("call filter " + _filterHolder);
if (LOG.isDebugEnabled())
LOG.debug("call filter " + _filterHolder);
Filter filter= _filterHolder.getFilter();
if (_filterHolder.isAsyncSupported())
filter.doFilter(request, response, _next);
@ -1346,8 +1349,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);
final Request baseRequest=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
_servletHolder.handle(baseRequest,request, response);
}
@ -1386,13 +1389,13 @@ 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())
@ -1418,7 +1421,7 @@ 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

View File

@ -41,6 +41,7 @@ import org.eclipse.jetty.security.RunAsToken;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -56,6 +57,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope, Comparable
{
private static final Logger LOG = Log.getLogger(ServletHolder.class);
/* ---------------------------------------------------------------- */
private int _initOrder;
private boolean _initOnStartup=false;
@ -264,7 +267,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
catch(Exception e)
{
if (_servletHandler.isStartWithUnavailable())
Log.ignore(e);
LOG.ignore(e);
else
throw e;
}
@ -287,7 +290,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
finally
{
@ -371,7 +374,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
}
catch(Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
return isStarted()&& _unavailable==0;
@ -408,7 +411,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
{
ServletContext ctx = _servletHandler.getServletContext();
if (ctx==null)
Log.info("unavailable",e);
LOG.info("unavailable",e);
else
ctx.log("unavailable",e);
_unavailableEx=new UnavailableException(String.valueOf(e),-1)
@ -663,7 +666,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
synchronized(this)
{
while(_stack.size()>0)
try { (_stack.pop()).destroy(); } catch (Exception e) { Log.warn(e); }
try { (_stack.pop()).destroy(); } catch (Exception e) { LOG.warn(e); }
}
}

View File

@ -30,9 +30,12 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.StatisticsHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class StatisticsServlet extends HttpServlet
{
private static final Logger LOG = Log.getLogger(StatisticsServlet.class);
boolean _restrictToLocalhost = true; // defaults to true
private StatisticsHandler _statsHandler;
private MemoryMXBean _memoryBean;
@ -52,7 +55,7 @@ public class StatisticsServlet extends HttpServlet
}
else
{
Log.warn("Statistics Handler not installed!");
LOG.warn("Statistics Handler not installed!");
return;
}
@ -75,7 +78,7 @@ public class StatisticsServlet extends HttpServlet
{
if (_statsHandler == null)
{
Log.warn("Statistics Handler not installed!");
LOG.warn("Statistics Handler not installed!");
resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
return;
}

View File

@ -24,6 +24,7 @@ import javax.servlet.ServletContextListener;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* ELContextCleaner
@ -36,6 +37,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class ELContextCleaner implements ServletContextListener
{
private static final Logger LOG = Log.getLogger(ELContextCleaner.class);
public void contextInitialized(ServletContextEvent sce)
{
@ -54,7 +57,7 @@ public class ELContextCleaner implements ServletContextListener
//Get rid of references
purgeEntries(field);
Log.info("javax.el.BeanELResolver purged");
LOG.info("javax.el.BeanELResolver purged");
}
catch (ClassNotFoundException e)
@ -63,19 +66,19 @@ public class ELContextCleaner implements ServletContextListener
}
catch (SecurityException e)
{
Log.warn("Cannot purge classes from javax.el.BeanELResolver", e);
LOG.warn("Cannot purge classes from javax.el.BeanELResolver", e);
}
catch (IllegalArgumentException e)
{
Log.warn("Cannot purge classes from javax.el.BeanELResolver", e);
LOG.warn("Cannot purge classes from javax.el.BeanELResolver", e);
}
catch (IllegalAccessException e)
{
Log.warn("Cannot purge classes from javax.el.BeanELResolver", e);
LOG.warn("Cannot purge classes from javax.el.BeanELResolver", e);
}
catch (NoSuchFieldException e)
{
Log.warn("Cannot purge classes from javax.el.BeanELResolver", e);
LOG.warn("Cannot purge classes from javax.el.BeanELResolver", e);
}
}
@ -107,14 +110,14 @@ public class ELContextCleaner implements ServletContextListener
while (itor.hasNext())
{
Class clazz = itor.next();
Log.info("Clazz: "+clazz+" loaded by "+clazz.getClassLoader());
LOG.info("Clazz: "+clazz+" loaded by "+clazz.getClassLoader());
if (Thread.currentThread().getContextClassLoader().equals(clazz.getClassLoader()))
{
itor.remove();
Log.info("removed");
LOG.info("removed");
}
else
Log.info("not removed: "+"contextclassloader="+Thread.currentThread().getContextClassLoader()+"clazz's classloader="+clazz.getClassLoader());
LOG.info("not removed: "+"contextclassloader="+Thread.currentThread().getContextClassLoader()+"clazz's classloader="+clazz.getClassLoader());
}
}
}

View File

@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
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;
//-----------------------------------------------------------------------------
/**
@ -54,6 +55,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class CGI extends HttpServlet
{
private static final Logger LOG = Log.getLogger(CGI.class);
private boolean _ok;
private File _docRoot;
private String _path;
@ -77,26 +80,26 @@ public class CGI extends HttpServlet
if (tmp==null)
{
Log.warn("CGI: no CGI bin !");
LOG.warn("CGI: no CGI bin !");
return;
}
File dir=new File(tmp);
if (!dir.exists())
{
Log.warn("CGI: CGI bin does not exist - "+dir);
LOG.warn("CGI: CGI bin does not exist - "+dir);
return;
}
if (!dir.canRead())
{
Log.warn("CGI: CGI bin is not readable - "+dir);
LOG.warn("CGI: CGI bin is not readable - "+dir);
return;
}
if (!dir.isDirectory())
{
Log.warn("CGI: CGI bin is not a directory - "+dir);
LOG.warn("CGI: CGI bin is not a directory - "+dir);
return;
}
@ -106,7 +109,7 @@ public class CGI extends HttpServlet
}
catch (IOException e)
{
Log.warn("CGI: CGI bin failed - "+dir,e);
LOG.warn("CGI: CGI bin failed - "+dir,e);
return;
}
@ -145,14 +148,14 @@ public class CGI extends HttpServlet
String pathInContext=StringUtil.nonNull(req.getServletPath())+StringUtil.nonNull(req.getPathInfo());
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("CGI: ContextPath : "+req.getContextPath());
Log.debug("CGI: ServletPath : "+req.getServletPath());
Log.debug("CGI: PathInfo : "+req.getPathInfo());
Log.debug("CGI: _docRoot : "+_docRoot);
Log.debug("CGI: _path : "+_path);
Log.debug("CGI: _ignoreExitState: "+_ignoreExitState);
LOG.debug("CGI: ContextPath : "+req.getContextPath());
LOG.debug("CGI: ServletPath : "+req.getServletPath());
LOG.debug("CGI: PathInfo : "+req.getPathInfo());
LOG.debug("CGI: _docRoot : "+_docRoot);
LOG.debug("CGI: _path : "+_path);
LOG.debug("CGI: _ignoreExitState: "+_ignoreExitState);
}
// pathInContext may actually comprises scriptName/pathInfo...We will
@ -180,10 +183,10 @@ public class CGI extends HttpServlet
}
else
{
if (Log.isDebugEnabled())
if (LOG.isDebugEnabled())
{
Log.debug("CGI: script is "+exe);
Log.debug("CGI: pathInfo is "+last);
LOG.debug("CGI: script is "+exe);
LOG.debug("CGI: pathInfo is "+last);
}
exec(exe,last,req,res);
}
@ -281,7 +284,7 @@ public class CGI extends HttpServlet
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
}).start();
@ -335,7 +338,7 @@ public class CGI extends HttpServlet
int exitValue=p.exitValue();
if (0!=exitValue)
{
Log.warn("Non-zero exit status ("+exitValue+") from CGI program: "+path);
LOG.warn("Non-zero exit status ("+exitValue+") from CGI program: "+path);
if (!res.isCommitted())
res.sendError(500,"Failed to exec CGI");
}
@ -345,11 +348,11 @@ public class CGI extends HttpServlet
{
// browser has probably closed its input stream - we
// terminate and clean up...
Log.debug("CGI: Client closed connection!");
LOG.debug("CGI: Client closed connection!");
}
catch (InterruptedException ie)
{
Log.debug("CGI: interrupted!");
LOG.debug("CGI: interrupted!");
}
finally
{
@ -361,12 +364,12 @@ public class CGI extends HttpServlet
}
catch(Exception e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
os = null;
p.destroy();
// Log.debug("CGI: terminated!");
// LOG.debug("CGI: terminated!");
}
}

View File

@ -21,6 +21,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.HttpConnection;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** Closeable DoS Filter.
@ -30,6 +31,8 @@ import org.eclipse.jetty.util.log.Log;
public class CloseableDoSFilter extends DoSFilter
{
private static final Logger LOG = Log.getLogger(CloseableDoSFilter.class);
protected void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
{
try
@ -39,7 +42,7 @@ public class CloseableDoSFilter extends DoSFilter
}
catch(IOException e)
{
Log.warn(e);
LOG.warn(e);
}
}
}

View File

@ -28,6 +28,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;
/**
* <p>Implementation of the
@ -73,6 +74,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class CrossOriginFilter implements Filter
{
private static final Logger LOG = Log.getLogger(CrossOriginFilter.class);
// Request headers
private static final String ORIGIN_HEADER = "Origin";
private static final String ACCESS_CONTROL_REQUEST_METHOD_HEADER = "Access-Control-Request-Method";
@ -138,14 +141,14 @@ public class CrossOriginFilter implements Filter
}
catch (NumberFormatException x)
{
Log.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(ALLOWED_CREDENTIALS_PARAM);
if (allowedCredentialsConfig == null) allowedCredentialsConfig = "false";
allowCredentials = Boolean.parseBoolean(allowedCredentialsConfig);
Log.debug("Cross-origin filter configuration: " +
LOG.debug("Cross-origin filter configuration: " +
ALLOWED_ORIGINS_PARAM + " = " + allowedOriginsConfig + ", " +
ALLOWED_METHODS_PARAM + " = " + allowedMethodsConfig + ", " +
ALLOWED_HEADERS_PARAM + " = " + allowedHeadersConfig + ", " +
@ -168,18 +171,18 @@ public class CrossOriginFilter implements Filter
{
if (isSimpleRequest(request))
{
Log.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
{
Log.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
{
Log.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);
}
}
@ -252,20 +255,20 @@ public class CrossOriginFilter implements Filter
private boolean isMethodAllowed(HttpServletRequest request)
{
String accessControlRequestMethod = request.getHeader(ACCESS_CONTROL_REQUEST_METHOD_HEADER);
Log.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);
}
Log.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);
Log.debug("{} is {}", ACCESS_CONTROL_REQUEST_HEADERS_HEADER, accessControlRequestHeaders);
LOG.debug("{} is {}", ACCESS_CONTROL_REQUEST_HEADERS_HEADER, accessControlRequestHeaders);
boolean result = true;
if (accessControlRequestHeaders != null)
{
@ -288,7 +291,7 @@ public class CrossOriginFilter implements Filter
}
}
}
Log.debug("Headers [{}] are" + (result ? "" : " not") + " among allowed headers {}", accessControlRequestHeaders, allowedHeaders);
LOG.debug("Headers [{}] are" + (result ? "" : " not") + " among allowed headers {}", accessControlRequestHeaders, allowedHeaders);
return result;
}

View File

@ -39,6 +39,7 @@ import org.eclipse.jetty.continuation.ContinuationListener;
import org.eclipse.jetty.continuation.ContinuationSupport;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.Timeout;
/**
@ -112,6 +113,8 @@ import org.eclipse.jetty.util.thread.Timeout;
public class DoSFilter implements Filter
{
private static final Logger LOG = Log.getLogger(DoSFilter.class);
final static String __TRACKER = "DoSFilter.Tracker";
final static String __THROTTLED = "DoSFilter.Throttled";
@ -276,13 +279,13 @@ public class DoSFilter implements Filter
}
catch (InterruptedException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
}
finally
{
Log.info("DoSFilter timer exited");
LOG.info("DoSFilter timer exited");
}
}
});
@ -321,7 +324,7 @@ public class DoSFilter implements Filter
}
// We are over the limit.
Log.warn("DOS ALERT: ip="+srequest.getRemoteAddr()+",session="+srequest.getRequestedSessionId()+",user="+srequest.getUserPrincipal());
LOG.warn("DOS ALERT: ip="+srequest.getRemoteAddr()+",session="+srequest.getRequestedSessionId()+",user="+srequest.getUserPrincipal());
// So either reject it, delay it or throttle it
switch((int)_delayMs)
@ -491,7 +494,7 @@ public class DoSFilter implements Filter
}
catch (IOException e)
{
Log.warn(e);
LOG.warn(e);
}
// interrupt the handling thread
@ -636,7 +639,7 @@ public class DoSFilter implements Filter
while (tokenizer.hasMoreTokens())
_whitelist.add(tokenizer.nextToken().trim());
Log.info("Whitelisted IP addresses: {}", _whitelist.toString());
LOG.info("Whitelisted IP addresses: {}", _whitelist.toString());
}
/* ------------------------------------------------------------ */

View File

@ -35,6 +35,7 @@ import org.eclipse.jetty.continuation.ContinuationSupport;
import org.eclipse.jetty.http.HttpMethods;
import org.eclipse.jetty.http.gzip.GzipResponseWrapper;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** GZIP Filter
@ -61,6 +62,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class GzipFilter extends UserAgentFilter
{
private static final Logger LOG = Log.getLogger(GzipFilter.class);
protected Set<String> _mimeTypes;
protected int _bufferSize=8192;
protected int _minGzipSize=256;
@ -156,7 +159,7 @@ public class GzipFilter extends UserAgentFilter
}
catch(IOException e)
{
Log.warn(e);
LOG.warn(e);
}
}

View File

@ -55,6 +55,7 @@ import org.eclipse.jetty.util.IO;
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.log.Logger;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.omg.CORBA._PolicyStub;
@ -87,6 +88,8 @@ import org.omg.CORBA._PolicyStub;
*/
public class ProxyServlet implements Servlet
{
private static final Logger LOG = Log.getLogger(ProxyServlet.class);
protected Logger _log;
protected HttpClient _client;
protected String _hostHeader;
@ -498,7 +501,7 @@ public class ProxyServlet implements Servlet
{
if (ex instanceof EofException)
{
Log.ignore(ex);
LOG.ignore(ex);
return;
}
handleOnException(ex,request,response);
@ -733,8 +736,8 @@ public class ProxyServlet implements Servlet
*/
protected void handleOnException(Throwable ex, HttpServletRequest request, HttpServletResponse response)
{
Log.warn(ex.toString());
Log.debug(ex);
LOG.warn(ex.toString());
LOG.debug(ex);
if (!response.isCommitted())
{
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

View File

@ -17,10 +17,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.BeforeClass;
public class CloseableDoSFilterTest extends AbstractDoSFilterTest
{
private static final Logger LOG = Log.getLogger(CloseableDoSFilterTest.class);
@BeforeClass
public static void setUp() throws Exception
{
@ -39,7 +42,7 @@ public class CloseableDoSFilterTest extends AbstractDoSFilterTest
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}

View File

@ -18,10 +18,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.BeforeClass;
public class DoSFilterTest extends AbstractDoSFilterTest
{
private static final Logger LOG = Log.getLogger(DoSFilterTest.class);
@BeforeClass
public static void setUp() throws Exception
{
@ -38,7 +41,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}

View File

@ -29,6 +29,7 @@ import org.eclipse.jetty.servlet.FilterMapping;
import org.eclipse.jetty.testing.HttpTester;
import org.eclipse.jetty.testing.ServletTester;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -38,6 +39,8 @@ import static org.junit.Assert.assertTrue;
public class QoSFilterTest
{
private static final Logger LOG = Log.getLogger(QoSFilterTest.class);
private ServletTester _tester;
private LocalConnector[] _connectors;
private CountDownLatch _doneRequests;
@ -176,8 +179,8 @@ public class QoSFilterTest
}
catch(Exception e)
{
Log.warn(String.valueOf(url));
Log.debug(e);
LOG.warn(String.valueOf(url));
LOG.debug(e);
}
}
}

View File

@ -9,9 +9,12 @@ import java.util.zip.Inflater;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ByteArrayBuffer;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class DeflateFrameExtension extends AbstractExtension
{
private static final Logger LOG = Log.getLogger(DeflateFrameExtension.class);
private int _minLength=8;
private Deflater _deflater;
private Inflater _inflater;
@ -80,7 +83,7 @@ public class DeflateFrameExtension extends AbstractExtension
}
catch(DataFormatException e)
{
Log.warn(e);
LOG.warn(e);
getConnection().close(WebSocketConnectionD10.CLOSE_PROTOCOL,e.toString());
}
}

View File

@ -11,9 +11,12 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class TestServer extends Server
{
private static final Logger LOG = Log.getLogger(TestServer.class);
boolean _verbose;
WebSocket _websocket;
@ -358,7 +361,7 @@ public class TestServer extends Server
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}

View File

@ -33,10 +33,13 @@ import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocket.OnFrame;
public class WebSocketConnectionD00 extends AbstractConnection implements WebSocketConnection, WebSocket.FrameConnection
{
private static final Logger LOG = Log.getLogger(WebSocketConnectionD00.class);
public final static byte LENGTH_FRAME=(byte)0x80;
public final static byte SENTINEL_FRAME=(byte)0x00;
@ -171,14 +174,14 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc
}
catch(IOException e)
{
Log.debug(e);
LOG.debug(e);
try
{
_endp.close();
}
catch(IOException e2)
{
Log.ignore(e2);
LOG.ignore(e2);
}
throw e;
}
@ -294,7 +297,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
@ -462,7 +465,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc
}
catch(Throwable th)
{
Log.warn(th);
LOG.warn(th);
}
}

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.util.B64Code;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocket.OnBinaryMessage;
import org.eclipse.jetty.websocket.WebSocket.OnControl;
import org.eclipse.jetty.websocket.WebSocket.OnFrame;
@ -40,6 +41,8 @@ import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
public class WebSocketConnectionD06 extends AbstractConnection implements WebSocketConnection
{
private static final Logger LOG = Log.getLogger(WebSocketConnectionD06.class);
final static byte OP_CONTINUATION = 0x00;
final static byte OP_CLOSE = 0x01;
final static byte OP_PING = 0x02;
@ -191,7 +194,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
}
catch(IOException e2)
{
Log.ignore(e2);
LOG.ignore(e2);
}
throw e;
}
@ -240,7 +243,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
/* ------------------------------------------------------------ */
public synchronized void closeIn(int code,String message)
{
Log.debug("ClosedIn {} {}",this,message);
LOG.debug("ClosedIn {} {}",this,message);
try
{
if (_closedOut)
@ -250,7 +253,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
finally
{
@ -261,7 +264,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
/* ------------------------------------------------------------ */
public synchronized void closeOut(int code,String message)
{
Log.debug("ClosedOut {} {}",this,message);
LOG.debug("ClosedOut {} {}",this,message);
try
{
if (_closedIn || _closedOut)
@ -280,7 +283,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
finally
{
@ -594,7 +597,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
}
case WebSocketConnectionD06.OP_PING:
{
Log.debug("PING {}",this);
LOG.debug("PING {}",this);
if (!_closedOut)
_connection.sendControl(WebSocketConnectionD06.OP_PONG,buffer.array(),buffer.getIndex(),buffer.length());
break;
@ -602,7 +605,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
case WebSocketConnectionD06.OP_PONG:
{
Log.debug("PONG {}",this);
LOG.debug("PONG {}",this);
break;
}
@ -687,7 +690,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
}
catch(Throwable th)
{
Log.warn(th);
LOG.warn(th);
}
}
}

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.util.B64Code;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocket.OnBinaryMessage;
import org.eclipse.jetty.websocket.WebSocket.OnControl;
import org.eclipse.jetty.websocket.WebSocket.OnFrame;
@ -41,6 +42,8 @@ import org.eclipse.jetty.websocket.WebSocketGeneratorD10.MaskGen;
public class WebSocketConnectionD10 extends AbstractConnection implements WebSocketConnection
{
private static final Logger LOG = Log.getLogger(WebSocketConnectionD10.class);
final static byte OP_CONTINUATION = 0x00;
final static byte OP_TEXT = 0x01;
final static byte OP_BINARY = 0x02;
@ -243,7 +246,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
}
catch(IOException e2)
{
Log.ignore(e2);
LOG.ignore(e2);
}
throw e;
}
@ -303,7 +306,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
/* ------------------------------------------------------------ */
public void closeIn(int code,String message)
{
Log.debug("ClosedIn {} {}",this,message);
LOG.debug("ClosedIn {} {}",this,message);
final boolean closedOut;
final boolean closed;
@ -335,7 +338,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
}
@ -343,7 +346,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
/* ------------------------------------------------------------ */
public void closeOut(int code,String message)
{
Log.debug("ClosedOut {} {}",this,message);
LOG.debug("ClosedOut {} {}",this,message);
final boolean close;
final boolean closed;
@ -384,7 +387,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
}
@ -679,7 +682,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
}
case WebSocketConnectionD10.OP_PING:
{
Log.debug("PING {}",this);
LOG.debug("PING {}",this);
if (!_closedOut)
_connection.sendControl(WebSocketConnectionD10.OP_PONG,buffer.array(),buffer.getIndex(),buffer.length());
break;
@ -687,7 +690,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
case WebSocketConnectionD10.OP_PONG:
{
Log.debug("PONG {}",this);
LOG.debug("PONG {}",this);
break;
}
@ -760,7 +763,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
}
catch(Throwable th)
{
Log.warn(th);
LOG.warn(th);
}
}
@ -789,7 +792,7 @@ public class WebSocketConnectionD10 extends AbstractConnection implements WebSoc
public void close(int code,String message)
{
if (code!=CLOSE_NORMAL)
Log.warn("Close: "+code+" "+message);
LOG.warn("Close: "+code+" "+message);
_connection.close(code,message);
}

View File

@ -30,12 +30,15 @@ import org.eclipse.jetty.io.ConnectedEndPoint;
import org.eclipse.jetty.server.HttpConnection;
import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* Factory to create WebSocket connections
*/
public class WebSocketFactory
{
private static final Logger LOG = Log.getLogger(WebSocketFactory.class);
public interface Acceptor
{
/* ------------------------------------------------------------ */
@ -182,7 +185,7 @@ public class WebSocketFactory
connection = new WebSocketConnectionD10(websocket, endp, _buffers, http.getTimeStamp(), _maxIdleTime, protocol,extensions,draft);
break;
default:
Log.warn("Unsupported Websocket version: "+draft);
LOG.warn("Unsupported Websocket version: "+draft);
throw new HttpException(400, "Unsupported draft specification: " + draft);
}
@ -278,11 +281,11 @@ public class WebSocketFactory
if (extension.init(parameters))
{
Log.debug("add {} {}",extName,parameters);
LOG.debug("add {} {}",extName,parameters);
extensions.add(extension);
}
}
Log.debug("extensions={}",extensions);
LOG.debug("extensions={}",extensions);
return extensions;
}
@ -296,7 +299,7 @@ public class WebSocketFactory
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
return null;

View File

@ -19,6 +19,7 @@ import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.Buffers;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -30,6 +31,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class WebSocketParserD00 implements WebSocketParser
{
private static final Logger LOG = Log.getLogger(WebSocketParserD00.class);
public static final int STATE_START=0;
public static final int STATE_SENTINEL_DATA=1;
public static final int STATE_LENGTH=2;
@ -112,7 +115,7 @@ public class WebSocketParserD00 implements WebSocketParser
}
catch(IOException e)
{
Log.debug(e);
LOG.debug(e);
return total_filled>0?total_filled:-1;
}
}

View File

@ -19,6 +19,7 @@ import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.Buffers;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -28,7 +29,9 @@ import org.eclipse.jetty.util.log.Log;
*
*/
public class WebSocketParserD06 implements WebSocketParser
{
{
private static final Logger LOG = Log.getLogger(WebSocketParserD06.class);
public enum State {
START(0), MASK(4), OPCODE(1), LENGTH_7(1), LENGTH_16(2), LENGTH_63(8), DATA(0), SKIP(1);
@ -131,7 +134,7 @@ public class WebSocketParserD06 implements WebSocketParser
}
catch(IOException e)
{
Log.debug(e);
LOG.debug(e);
return (total_filled+events)>0?(total_filled+events):-1;
}
}

View File

@ -19,6 +19,7 @@ import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.Buffers;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -28,7 +29,9 @@ import org.eclipse.jetty.util.log.Log;
*
*/
public class WebSocketParserD10 implements WebSocketParser
{
{
private static final Logger LOG = Log.getLogger(WebSocketParserD10.class);
public enum State {
START(0), OPCODE(1), LENGTH_7(1), LENGTH_16(2), LENGTH_63(8), MASK(4), PAYLOAD(0), DATA(0), SKIP(1);
@ -177,7 +180,7 @@ public class WebSocketParserD10 implements WebSocketParser
}
catch(IOException e)
{
Log.debug(e);
LOG.debug(e);
return (total_filled+events)>0?(total_filled+events):-1;
}
}
@ -205,7 +208,7 @@ public class WebSocketParserD10 implements WebSocketParser
if (WebSocketConnectionD10.isControlFrame(_opcode)&&!WebSocketConnectionD10.isLastFrame(_flags))
{
events++;
Log.warn("Fragmented Control from "+_endp);
LOG.warn("Fragmented Control from "+_endp);
_handler.close(WebSocketConnectionD10.CLOSE_PROTOCOL,"Fragmented control");
_skip=true;
}