From 363c18a29eef75ddbe9be1014d9891cf473eca83 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 13 Jun 2014 23:03:37 +0200 Subject: [PATCH] Improved logging. --- .../org/eclipse/jetty/http2/HTTP2Session.java | 16 ++++++++++++++++ .../jetty/http2/frames/WindowUpdateFrame.java | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java index 3f3353a818f..736cbb4332a 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java @@ -112,6 +112,8 @@ public abstract class HTTP2Session implements ISession, Parser.Listener @Override public boolean onData(final DataFrame frame) { + if (LOG.isDebugEnabled()) + LOG.debug("Received {}", frame); int streamId = frame.getStreamId(); final IStream stream = getStream(streamId); if (stream != null) @@ -157,6 +159,8 @@ public abstract class HTTP2Session implements ISession, Parser.Listener @Override public boolean onSettings(SettingsFrame frame) { + if (LOG.isDebugEnabled()) + LOG.debug("Received {}", frame); Map settings = frame.getSettings(); if (settings.containsKey(SettingsFrame.MAX_CONCURRENT_STREAMS)) { @@ -177,6 +181,8 @@ public abstract class HTTP2Session implements ISession, Parser.Listener @Override public boolean onPing(PingFrame frame) { + if (LOG.isDebugEnabled()) + LOG.debug("Received {}", frame); if (frame.isReply()) { notifyPing(this, frame); @@ -221,6 +227,8 @@ public abstract class HTTP2Session implements ISession, Parser.Listener @Override public boolean onWindowUpdate(WindowUpdateFrame frame) { + if (LOG.isDebugEnabled()) + LOG.debug("Received {}", frame); int streamId = frame.getStreamId(); IStream stream = null; if (streamId > 0) @@ -616,6 +624,8 @@ public abstract class HTTP2Session implements ISession, Parser.Listener } List byteBuffers = lease.getByteBuffers(); + if (LOG.isDebugEnabled()) + LOG.debug("Writing {} buffers ({} bytes) for {}", byteBuffers.size(), lease.getTotalLength(), active); endPoint.write(this, byteBuffers.toArray(new ByteBuffer[byteBuffers.size()])); return Action.SCHEDULED; } @@ -716,6 +726,12 @@ public abstract class HTTP2Session implements ISession, Parser.Listener { callback.failed(x); } + + @Override + public String toString() + { + return frame.toString(); + } } private class DataFlusherEntry extends FlusherEntry diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/frames/WindowUpdateFrame.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/frames/WindowUpdateFrame.java index ee0837ddc60..b5909dfa831 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/frames/WindowUpdateFrame.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/frames/WindowUpdateFrame.java @@ -39,4 +39,10 @@ public class WindowUpdateFrame extends Frame { return windowDelta; } + + @Override + public String toString() + { + return String.format("%s{delta=%d}", super.toString(), windowDelta); + } }