jetty-9 improved logging
This commit is contained in:
parent
3d029695ec
commit
16b404754e
|
@ -21,6 +21,7 @@ import java.util.EnumSet;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -104,7 +105,7 @@ abstract public class WriteFlusher
|
|||
throw new IllegalStateException();
|
||||
|
||||
boolean updated = _state.compareAndSet(previous, next);
|
||||
LOG.debug("State update {} -> {} succeeded: {}", previous, next, updated);
|
||||
LOG.debug("update {}:{}{}{}", this, previous, updated?"-->":"!->",next);
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
@ -139,7 +140,7 @@ abstract public class WriteFlusher
|
|||
Set<StateType> allowedNewStateTypes = __stateTransitions.get(currentState.getType());
|
||||
if (!allowedNewStateTypes.contains(newState.getType()))
|
||||
{
|
||||
LOG.debug("StateType update: {} -> {} not allowed", currentState, newState);
|
||||
LOG.warn("{}: {} -> {} not allowed", this, currentState, newState);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -280,9 +281,11 @@ abstract public class WriteFlusher
|
|||
*/
|
||||
public <C> void write(C context, Callback<C> callback, ByteBuffer... buffers) throws WritePendingException
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("write: {} {}", this, BufferUtil.toDetailString(buffers));
|
||||
|
||||
if (callback == null)
|
||||
throw new IllegalArgumentException();
|
||||
LOG.debug("write: {}", this);
|
||||
|
||||
if (!updateState(__IDLE,__WRITING))
|
||||
throw new WritePendingException();
|
||||
|
@ -330,6 +333,8 @@ abstract public class WriteFlusher
|
|||
*/
|
||||
public void completeWrite()
|
||||
{
|
||||
LOG.debug("completeWrite: {}", this);
|
||||
|
||||
State previous = _state.get();
|
||||
|
||||
if (previous.getType()!=StateType.PENDING)
|
||||
|
|
|
@ -143,6 +143,7 @@ public class SslConnection extends AbstractConnection
|
|||
|
||||
_decryptedEndPoint.getWriteFlusher().completeWrite();
|
||||
}
|
||||
LOG.debug("{} onFilled", this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -383,8 +384,8 @@ public class SslConnection extends AbstractConnection
|
|||
// case we want to fall through to the handshake handling
|
||||
int pos = BufferUtil.flipToFill(app_in);
|
||||
SSLEngineResult unwrapResult = _sslEngine.unwrap(_encryptedInput, app_in);
|
||||
LOG.debug("{} unwrap {}", SslConnection.this, unwrapResult);
|
||||
BufferUtil.flipToFlush(app_in, pos);
|
||||
LOG.debug("{} unwrap {}", SslConnection.this, unwrapResult);
|
||||
|
||||
// and deal with the results
|
||||
switch (unwrapResult.getStatus())
|
||||
|
|
|
@ -57,6 +57,7 @@ public abstract class AbstractTest
|
|||
protected InetSocketAddress startServer(short version, ServerSessionFrameListener listener) throws Exception
|
||||
{
|
||||
server = new Server();
|
||||
((QueuedThreadPool)server.getThreadPool()).setName("server");
|
||||
if (connector == null)
|
||||
connector = newSPDYServerConnector(listener);
|
||||
if (listener == null)
|
||||
|
|
|
@ -18,9 +18,13 @@ import java.util.Map;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.io.SelectChannelEndPoint;
|
||||
import org.eclipse.jetty.io.WriteFlusher;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection;
|
||||
import org.eclipse.jetty.npn.NextProtoNego;
|
||||
import org.eclipse.jetty.spdy.api.Session;
|
||||
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -702,6 +702,19 @@ public class BufferUtil
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String toDetailString(ByteBuffer[] buffer)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append('[');
|
||||
for (int i=0;i<buffer.length;i++)
|
||||
{
|
||||
if (i>0) builder.append(',');
|
||||
builder.append(toDetailString(buffer[i]));
|
||||
}
|
||||
builder.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String toDetailString(ByteBuffer buffer)
|
||||
{
|
||||
if (buffer==null)
|
||||
|
|
|
@ -460,7 +460,7 @@ public class StdErrLog extends AbstractLogger
|
|||
buffer.append(_abbrevname);
|
||||
}
|
||||
buffer.append(':');
|
||||
buffer.append(Thread.currentThread().getId()).append(": ");
|
||||
buffer.append(Thread.currentThread().getName()).append(": ");
|
||||
if (_source)
|
||||
{
|
||||
Throwable source = new Throwable();
|
||||
|
|
Loading…
Reference in New Issue