Improved logging.

This commit is contained in:
Simone Bordet 2014-08-02 23:04:51 +02:00
parent 1fb07644a1
commit e332aa9c43
4 changed files with 14 additions and 4 deletions

View File

@ -724,7 +724,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
List<ByteBuffer> byteBuffers = lease.getByteBuffers();
if (LOG.isDebugEnabled())
LOG.debug("Writing {} buffers ({} bytes) for {}", byteBuffers.size(), lease.getTotalLength(), active);
LOG.debug("Writing {} buffers ({} bytes) for {} frames {}", byteBuffers.size(), lease.getTotalLength(), active.size(), active);
endPoint.write(this, byteBuffers.toArray(new ByteBuffer[byteBuffers.size()]));
return Action.SCHEDULED;
}
@ -739,6 +739,9 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
complete.add(active.get(i));
active.clear();
if (LOG.isDebugEnabled())
LOG.debug("Written {} frames for {}", complete.size(), complete);
// Drain the queue one by one to avoid reentrancy.
while (!complete.isEmpty())
{

View File

@ -75,6 +75,6 @@ public class DataFrame extends Frame
@Override
public String toString()
{
return String.format("%s{length:%d,end=%b}", super.toString(), data.remaining(), endStream);
return String.format("%s#%d{length:%d,end=%b}", super.toString(), streamId, data.remaining(), endStream);
}
}

View File

@ -55,4 +55,10 @@ public class HeadersFrame extends Frame
{
return endStream;
}
@Override
public String toString()
{
return String.format("%s#%d", super.toString(), streamId);
}
}

View File

@ -151,8 +151,9 @@ public class Parser
}
catch (Throwable x)
{
LOG.debug(x);
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "parser_error: "+x);
if (LOG.isDebugEnabled())
LOG.debug(x);
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "parser_error");
return false;
}
}