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 | 48886608aa16594be0523df603462b2b77d73172 (patch) | |
| tree | 5b8a2ec524ce96a43da1f75ff936eca1ea7bf6c7 /java/client/src | |
| parent | 6559188d55660d876517cf4dacc270fe4ed5b533 (diff) | |
| download | qpid-python-48886608aa16594be0523df603462b2b77d73172.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/qpid@676982 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java index 8ac4f843de..c07e4d6c2e 100644 --- a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java +++ b/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(); |
