diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2008-07-15 17:17:16 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2008-07-15 17:17:16 +0000 |
| commit | d6bea62aa99a21a133524bc48fd138e93e7f62c0 (patch) | |
| tree | 2065b1c505a82f1b4ea2b67a93fb923bdf103796 /qpid/java/client/src | |
| parent | ba373f4b9b54023b1a0f70c065a1e6f153b432ba (diff) | |
| download | qpid-python-d6bea62aa99a21a133524bc48fd138e93e7f62c0.tar.gz | |
QPID-1177 : Added Protocol Level Debug logging. Uses a final static so should JIT out if disabled. To enable set -Damqj.protocol.logging.level=info
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@676982 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java index 8ac4f843de..c07e4d6c2e 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java @@ -122,6 +122,8 @@ public class AMQProtocolHandler extends IoHandlerAdapter { /** Used for debugging. */ private static final Logger _logger = LoggerFactory.getLogger(AMQProtocolHandler.class); + private static final Logger _protocolLogger = LoggerFactory.getLogger("qpid.protocol"); + private static final boolean PROTOCOL_DEBUG = (System.getProperty("amqj.protocol.logging.level") != null); /** * The connection that this protocol handler is associated with. There is a 1-1 mapping between connection @@ -484,7 +486,12 @@ public class AMQProtocolHandler extends IoHandlerAdapter public void messageReceived(IoSession session, Object message) throws Exception { - if (message instanceof AMQFrame) + if (PROTOCOL_DEBUG) + { + _protocolLogger.info("Recv:"+message); + } + + if(message instanceof AMQFrame) { final boolean debug = _logger.isDebugEnabled(); final long msgNumber = ++_messageReceivedCount; @@ -565,6 +572,11 @@ public class AMQProtocolHandler extends IoHandlerAdapter public void messageSent(IoSession session, Object message) throws Exception { + if (PROTOCOL_DEBUG) + { + _protocolLogger.info("Send:"+message); + } + final long sentMessages = _messagesOut++; final boolean debug = _logger.isDebugEnabled(); |
