mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@420711 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eafa72d7cb
commit
43cba856e4
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue