From 43cba856e40ed9ccfb2c0dc988a825ec6b242b2f Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Tue, 11 Jul 2006 04:28:30 +0000 Subject: [PATCH] http://issues.apache.org/activemq/browse/AMQ-809 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@420711 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/transport/TransportLogger.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java index 85bc12e3e1..67b08ec819 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java @@ -19,6 +19,7 @@ package org.apache.activemq.transport; import java.io.IOException; import org.apache.activemq.command.Command; +import org.apache.activemq.command.Response; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,7 +33,7 @@ public class TransportLogger extends TransportFilter { private final Log log; public TransportLogger(Transport next) { - this( next, LogFactory.getLog(TransportLogger.class.getName()+":"+getNextId())); + this( next, LogFactory.getLog(TransportLogger.class.getName()+".Connection:"+getNextId())); } synchronized private static int getNextId() { @@ -44,6 +45,26 @@ public class TransportLogger extends TransportFilter { this.log = log; } + public Response request(Command command) throws IOException { + log.debug("SENDING REQUEST: "+command); + Response rc = super.request(command); + log.debug("GOT RESPONSE: "+rc); + return rc; + } + + public Response request(Command command, int timeout) throws IOException { + log.debug("SENDING REQUEST: "+command); + Response rc = super.request(command, timeout); + log.debug("GOT RESPONSE: "+rc); + return rc; + } + + public FutureResponse asyncRequest(Command command, ResponseCallback responseCallback) throws IOException { + log.debug("SENDING ASNYC REQUEST: "+command); + FutureResponse rc = next.asyncRequest(command, responseCallback); + return rc; + } + public void oneway(Command command) throws IOException { if( log.isDebugEnabled() ) { log.debug("SENDING: "+command); @@ -53,7 +74,11 @@ public class TransportLogger extends TransportFilter { public void onCommand(Command command) { if( log.isDebugEnabled() ) { - log.debug("RECEIVED: from: "+ command.getFrom() + " : " + command); + if( command.getFrom()!=null ) { + log.debug("RECEIVED: from: "+ command.getFrom() + " : " + command); + } else { + log.debug("RECEIVED: " + command); + } } getTransportListener().onCommand(command); }