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

+ Finished conversion of jetty-continuation, jetty-http, jetty-io
This commit is contained in:
Joakim Erdfelt 2011-08-24 12:51:39 -07:00
parent b63e56e8e1
commit f15617fbb2
15 changed files with 93 additions and 50 deletions

View File

@ -8,8 +8,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;
import org.mortbay.log.Log;
import org.mortbay.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -19,6 +18,8 @@ import org.mortbay.log.Log;
*/
public class Jetty6Continuation implements ContinuationFilter.FilteredContinuation
{
private static final Logger LOG = Log.getLogger(Jetty6Continuation.class.getName());
// Exception reused for all continuations
// Turn on debug in ContinuationFilter to see real stack trace.
private final static ContinuationThrowable __exception = new ContinuationThrowable();
@ -40,7 +41,7 @@ public class Jetty6Continuation implements ContinuationFilter.FilteredContinuati
{
if (!ContinuationFilter._initialized)
{
Log.warn("!ContinuationFilter installed");
LOG.warn("!ContinuationFilter installed",null,null);
throw new IllegalStateException("!ContinuationFilter installed");
}
_request=request;

View File

@ -22,6 +22,7 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.io.View;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -34,6 +35,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public abstract class AbstractGenerator implements Generator
{
private static final Logger LOG = Log.getLogger(AbstractGenerator.class);
// states
public final static int STATE_HEADER = 0;
public final static int STATE_CONTENT = 2;
@ -410,8 +413,8 @@ public abstract class AbstractGenerator implements Generator
if (_contentLength >= 0 && _contentLength != _contentWritten && !_head)
{
if (Log.isDebugEnabled())
Log.debug("ContentLength written=="+_contentWritten+" != contentLength=="+_contentLength);
if (LOG.isDebugEnabled())
LOG.debug("ContentLength written=="+_contentWritten+" != contentLength=="+_contentLength);
_persistent = false;
}
}

View File

@ -44,6 +44,7 @@ import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.StringMap;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -55,7 +56,9 @@ import org.eclipse.jetty.util.log.Log;
*
*/
public class HttpFields
{
{
private static final Logger LOG = Log.getLogger(HttpFields.class);
/* ------------------------------------------------------------ */
public static final String __COOKIE_DELIM="\"\\\n\r\t\f\b%+ ;=";
public static final TimeZone __GMT = TimeZone.getTimeZone("GMT");
@ -242,7 +245,7 @@ public class HttpFields
}
catch (java.lang.Exception e)
{
// Log.ignore(e);
// LOG.ignore(e);
}
}
@ -259,7 +262,7 @@ public class HttpFields
}
catch (java.lang.Exception e)
{
// Log.ignore(e);
// LOG.ignore(e);
}
}
}
@ -1058,7 +1061,7 @@ public class HttpFields
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
return e.toString();
}
}

View File

@ -25,6 +25,7 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -35,6 +36,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class HttpGenerator extends AbstractGenerator
{
private static final Logger LOG = Log.getLogger(HttpGenerator.class);
// Build cache of response lines for status
private static class Status
{
@ -154,7 +157,7 @@ public class HttpGenerator extends AbstractGenerator
if (_last || _state==STATE_END)
{
Log.debug("Ignoring extra content {}",content);
LOG.debug("Ignoring extra content {}",content);
content.clear();
return;
}
@ -239,7 +242,7 @@ public class HttpGenerator extends AbstractGenerator
if (_last || _state==STATE_END)
{
Log.debug("Ignoring extra content {}",Byte.valueOf(b));
LOG.debug("Ignoring extra content {}",Byte.valueOf(b));
return false;
}
@ -345,7 +348,7 @@ public class HttpGenerator extends AbstractGenerator
}
catch(InterruptedException e)
{
Log.debug(e);
LOG.debug(e);
throw new InterruptedIOException(e.toString());
}
}
@ -912,7 +915,7 @@ public class HttpGenerator extends AbstractGenerator
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
throw (e instanceof EofException) ? e:new EofException(e);
}
}

View File

@ -26,9 +26,12 @@ import org.eclipse.jetty.io.View;
import org.eclipse.jetty.io.bio.StreamEndPoint;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class HttpParser implements Parser
{
private static final Logger LOG = Log.getLogger(HttpParser.class);
// States
public static final int STATE_START=-14;
public static final int STATE_FIELD0=-13;
@ -488,7 +491,7 @@ public class HttpParser implements Parser
}
catch(NumberFormatException e)
{
Log.ignore(e);
LOG.ignore(e);
throw new HttpException(HttpStatus.BAD_REQUEST_400);
}
if (_contentLength <= 0)
@ -930,7 +933,7 @@ public class HttpParser implements Parser
}
catch(IOException e)
{
Log.debug(e);
LOG.debug(e);
throw (e instanceof EofException) ? e:new EofException(e);
}
}

View File

@ -25,6 +25,7 @@ import org.eclipse.jetty.io.BufferCache;
import org.eclipse.jetty.io.BufferCache.CachedBuffer;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
@ -33,6 +34,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class MimeTypes
{
private static final Logger LOG = Log.getLogger(MimeTypes.class);
public final static String
FORM_ENCODED="application/x-www-form-urlencoded",
MESSAGE_HTTP="message/http",
@ -132,8 +135,8 @@ public class MimeTypes
}
catch(MissingResourceException e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
}
try
@ -148,8 +151,8 @@ public class MimeTypes
}
catch(MissingResourceException e)
{
Log.warn(e.toString());
Log.debug(e);
LOG.warn(e.toString());
LOG.debug(e);
}

View File

@ -19,6 +19,7 @@ import java.security.MessageDigest;
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;
/* ------------------------------------------------------------ */
/**
@ -37,6 +38,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public abstract class Credential implements Serializable
{
private static final Logger LOG = Log.getLogger(Credential.class);
private static final long serialVersionUID = -7760551052768181572L;
/* ------------------------------------------------------------ */
@ -91,7 +94,7 @@ public abstract class Credential implements Serializable
if (credentials instanceof char[])
credentials=new String((char[])credentials);
if (!(credentials instanceof String) && !(credentials instanceof Password))
Log.warn("Can't check " + credentials.getClass() + " against CRYPT");
LOG.warn("Can't check " + credentials.getClass() + " against CRYPT");
String passwd = credentials.toString();
return _cooked.equals(UnixCrypt.crypt(passwd, _cooked));
@ -172,13 +175,13 @@ public abstract class Credential implements Serializable
}
else
{
Log.warn("Can't check " + credentials.getClass() + " against MD5");
LOG.warn("Can't check " + credentials.getClass() + " against MD5");
return false;
}
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
return false;
}
}
@ -199,7 +202,7 @@ public abstract class Credential implements Serializable
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
return null;
}
}
@ -213,7 +216,7 @@ public abstract class Credential implements Serializable
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
return null;
}
}

View File

@ -17,6 +17,7 @@ import java.io.IOException;
import java.util.Arrays;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -48,6 +49,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class Password extends Credential
{
private static final Logger LOG = Log.getLogger(Password.class);
private static final long serialVersionUID = 5062906681431569445L;
public static final String __OBFUSCATE = "OBF:";
@ -210,7 +213,7 @@ public class Password extends Credential
}
catch (IOException e)
{
Log.warn(Log.EXCEPTION, e);
LOG.warn(Log.EXCEPTION, e);
}
if (passwd == null || passwd.length() == 0) passwd = promptDft;
}

View File

@ -19,6 +19,7 @@ import java.io.OutputStream;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
*
@ -26,6 +27,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public abstract class AbstractBuffer implements Buffer
{
private static final Logger LOG = Log.getLogger(AbstractBuffer.class);
private final static boolean __boundsChecking = Boolean.getBoolean("org.eclipse.jetty.io.AbstractBuffer.boundsChecking");
protected final static String
@ -637,7 +640,7 @@ public abstract class AbstractBuffer implements Buffer
}
catch(Exception e)
{
Log.warn(e);
LOG.warn(e);
return new String(asArray(), 0, length());
}
}

View File

@ -3,10 +3,13 @@ package org.eclipse.jetty.io;
import java.io.IOException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public abstract class AbstractConnection implements Connection
{
private static final Logger LOG = Log.getLogger(AbstractConnection.class);
private final long _timeStamp;
protected final EndPoint _endp;
@ -40,7 +43,7 @@ public abstract class AbstractConnection implements Connection
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
try
{
@ -48,7 +51,7 @@ public abstract class AbstractConnection implements Connection
}
catch(IOException e2)
{
Log.ignore(e2);
LOG.ignore(e2);
}
}

View File

@ -22,6 +22,7 @@ import java.io.PrintWriter;
import java.io.Writer;
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 UncheckedPrintWriter extends PrintWriter
{
private static final Logger LOG = Log.getLogger(UncheckedPrintWriter.class);
private boolean _autoFlush = false;
private boolean _throwUnchecked=true;
@ -105,7 +108,7 @@ public class UncheckedPrintWriter extends PrintWriter
setError();
if (_throwUnchecked)
throw new RuntimeIOException(th);
Log.debug(th);
LOG.debug(th);
}
/* ------------------------------------------------------------ */

View File

@ -20,6 +20,7 @@ import java.net.Socket;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
*
@ -28,6 +29,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class SocketEndPoint extends StreamEndPoint
{
private static final Logger LOG = Log.getLogger(SocketEndPoint.class);
final Socket _socket;
final InetSocketAddress _local;
final InetSocketAddress _remote;
@ -230,7 +233,7 @@ public class SocketEndPoint extends StreamEndPoint
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
_socket.close();
}
}

View File

@ -26,6 +26,7 @@ import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* Channel End Point.
@ -34,6 +35,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class ChannelEndPoint implements EndPoint
{
private static final Logger LOG = Log.getLogger(ChannelEndPoint.class);
protected final ByteChannel _channel;
protected final ByteBuffer[] _gather2=new ByteBuffer[2];
protected final Socket _socket;
@ -188,12 +191,12 @@ public class ChannelEndPoint implements EndPoint
}
catch (IOException xx)
{
Log.ignore(xx);
LOG.ignore(xx);
}
if (len>0)
throw x;
Log.ignore(x);
LOG.ignore(x);
len=-1;
}
}

View File

@ -22,9 +22,12 @@ import java.util.List;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.NetworkTrafficListener;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class NetworkTrafficSelectChannelEndPoint extends SelectChannelEndPoint
{
private static final Logger LOG = Log.getLogger(NetworkTrafficSelectChannelEndPoint.class);
private final List<NetworkTrafficListener> listeners;
public NetworkTrafficSelectChannelEndPoint(SocketChannel channel, SelectorManager.SelectSet selectSet, SelectionKey key, int maxIdleTime, List<NetworkTrafficListener> listeners) throws IOException
@ -74,7 +77,7 @@ public class NetworkTrafficSelectChannelEndPoint extends SelectChannelEndPoint
}
catch (Exception x)
{
Log.warn(x);
LOG.warn(x);
}
}
}
@ -93,7 +96,7 @@ public class NetworkTrafficSelectChannelEndPoint extends SelectChannelEndPoint
}
catch (Exception x)
{
Log.warn(x);
LOG.warn(x);
}
}
}
@ -114,7 +117,7 @@ public class NetworkTrafficSelectChannelEndPoint extends SelectChannelEndPoint
}
catch (Exception x)
{
Log.warn(x);
LOG.warn(x);
}
}
}
@ -132,7 +135,7 @@ public class NetworkTrafficSelectChannelEndPoint extends SelectChannelEndPoint
}
catch (Exception x)
{
Log.warn(x);
LOG.warn(x);
}
}
}

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.io.Buffers;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
@ -41,6 +42,8 @@ import org.eclipse.jetty.util.log.Logger;
*/
public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
private static final Logger LOG = Log.getLogger(SslSelectChannelEndPoint.class);
public static final Logger __log=Log.getLogger("org.eclipse.jetty.io.nio").getLogger("ssl");
private static final ByteBuffer[] __NO_BUFFERS={};
@ -247,7 +250,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
catch(SSLException e)
{
super.close();
Log.ignore(e);
LOG.ignore(e);
}
finally
{
@ -299,7 +302,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
}
catch (Exception x)
{
Log.debug(x);
LOG.debug(x);
super.close();
}
}
@ -440,7 +443,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
case BUFFER_OVERFLOW:
case BUFFER_UNDERFLOW:
Log.warn("wrap {}",_result);
LOG.warn("wrap {}",_result);
case CLOSED:
_closing=true;
}
@ -595,7 +598,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
case BUFFER_OVERFLOW:
case BUFFER_UNDERFLOW:
Log.warn("unwrap {}",_result);
LOG.warn("unwrap {}",_result);
case CLOSED:
_closing=true;
}
@ -656,7 +659,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
if (_handshook && !_allowRenegotiate && _channel!=null && _channel.isOpen())
{
Log.warn("SSL renegotiate denied: "+_channel);
LOG.warn("SSL renegotiate denied: "+_channel);
super.close();
}
}
@ -760,7 +763,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
}
catch(SSLException e)
{
Log.warn(getRemoteAddr() + ":" + getRemotePort() + " " + e);
LOG.warn(getRemoteAddr() + ":" + getRemotePort() + " " + e);
freeOutBuffer();
super.close();
throw e;
@ -784,7 +787,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
// If we are closed, we will never get more, so EOF
// else return and we will be tried again
// later when more data arriving causes another dispatch.
if (Log.isDebugEnabled()) Log.debug("unwrap {}",_result);
if (LOG.isDebugEnabled()) LOG.debug("unwrap {}",_result);
if(!isOpen())
{
_inNIOBuffer.clear();
@ -802,7 +805,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
// return true is some bytes somewhere were moved about.
return total_filled>0 ||_result.bytesConsumed()>0 || _result.bytesProduced()>0;
default:
Log.warn("unwrap "+_result);
LOG.warn("unwrap "+_result);
throw new IOException(_result.toString());
}
}
@ -854,7 +857,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
}
catch(SSLException e)
{
Log.warn(getRemoteAddr()+":"+getRemotePort()+" "+e);
LOG.warn(getRemoteAddr()+":"+getRemotePort()+" "+e);
super.close();
throw e;
}
@ -891,7 +894,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
case BUFFER_OVERFLOW:
case BUFFER_UNDERFLOW:
Log.warn("unwrap {}",_result);
LOG.warn("unwrap {}",_result);
case OK:
return _result.bytesConsumed();
@ -900,7 +903,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
return _result.bytesConsumed()>0?_result.bytesConsumed():-1;
default:
Log.warn("wrap "+_result);
LOG.warn("wrap "+_result);
throw new IOException(_result.toString());
}
}
@ -935,7 +938,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
}
catch(SSLException e)
{
Log.warn(getRemoteAddr()+":"+getRemotePort()+" "+e);
LOG.warn(getRemoteAddr()+":"+getRemotePort()+" "+e);
super.close();
throw e;
}
@ -961,7 +964,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
case BUFFER_OVERFLOW:
case BUFFER_UNDERFLOW:
Log.warn("unwrap {}",_result);
LOG.warn("unwrap {}",_result);
case OK:
return _result.bytesConsumed();
@ -970,7 +973,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
return _result.bytesConsumed()>0?_result.bytesConsumed():-1;
default:
Log.warn("wrap "+_result);
LOG.warn("wrap "+_result);
throw new IOException(_result.toString());
}
}