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