summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org = rgodfrey = Robert Godfrey rgodfrey@apache.org@apache.org>2014-04-11 22:48:38 +0000
committerRobert Godfrey <rgodfrey@apache.org = rgodfrey = Robert Godfrey rgodfrey@apache.org@apache.org>2014-04-11 22:48:38 +0000
commit1e13b57a17562ca81cd9133779ce6fd3d42faee7 (patch)
tree44d2ba08f321d7367e049d6c69cb98414f5a6a0d /qpid/java/broker-plugins
parent85b8f44076e0f66f628bcdf9becc17c5ead45402 (diff)
downloadqpid-python-1e13b57a17562ca81cd9133779ce6fd3d42faee7.tar.gz
QPID-5683 : [Java Broker] Make the AMQP 1.0 protocol logging available through log4j (like the rest of the broker) rather than java.logging
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1586792 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java41
1 files changed, 31 insertions, 10 deletions
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java
index 03b56bfb74..ef85e019e6 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java
@@ -28,24 +28,26 @@ import java.security.Principal;
import java.security.PrivilegedAction;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
import javax.security.auth.Subject;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
+
+import org.apache.log4j.Logger;
+
import org.apache.qpid.amqp_1_0.codec.FrameWriter;
import org.apache.qpid.amqp_1_0.codec.ProtocolHandler;
import org.apache.qpid.amqp_1_0.framing.AMQFrame;
import org.apache.qpid.amqp_1_0.framing.OversizeFrameException;
import org.apache.qpid.amqp_1_0.framing.SASLFrameHandler;
-import org.apache.qpid.amqp_1_0.transport.SaslServerProvider;
import org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint;
import org.apache.qpid.amqp_1_0.transport.Container;
import org.apache.qpid.amqp_1_0.transport.FrameOutputHandler;
+import org.apache.qpid.amqp_1_0.transport.SaslServerProvider;
import org.apache.qpid.amqp_1_0.type.Binary;
import org.apache.qpid.amqp_1_0.type.FrameBody;
import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.transport.*;
+import org.apache.qpid.amqp_1_0.type.transport.AmqpError;
import org.apache.qpid.amqp_1_0.type.transport.Error;
import org.apache.qpid.common.QpidProperties;
import org.apache.qpid.common.ServerPropertyNames;
@@ -185,7 +187,20 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut
SubjectCreator subjectCreator = _broker.getSubjectCreator(getLocalAddress());
_endpoint = new ConnectionEndpoint(container, asSaslServerProvider(subjectCreator));
+ _endpoint.setLogger(new ConnectionEndpoint.FrameReceiptLogger()
+ {
+ @Override
+ public boolean isEnabled()
+ {
+ return FRAME_LOGGER.isDebugEnabled();
+ }
+ @Override
+ public void received(final SocketAddress remoteAddress, final short channel, final Object frame)
+ {
+ FRAME_LOGGER.debug("RECV[" + remoteAddress + "|" + channel + "] : " + frame);
+ }
+ });
Map<Symbol,Object> serverProperties = new LinkedHashMap<Symbol, Object>();
serverProperties.put(Symbol.valueOf(ServerPropertyNames.PRODUCT), QpidProperties.getProductName());
serverProperties.put(Symbol.valueOf(ServerPropertyNames.VERSION), QpidProperties.getReleaseVersion());
@@ -196,6 +211,7 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut
_endpoint.setRemoteAddress(getRemoteAddress());
_connection = new Connection_1_0(_broker, _endpoint, _connectionId, _port, _transport, subjectCreator);
+
_endpoint.setConnectionEventListener(_connection);
_endpoint.setFrameOutputHandler(this);
_endpoint.setSaslFrameOutput(this);
@@ -262,13 +278,13 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut
try
{
_lastReadTime = System.currentTimeMillis();
- if(RAW_LOGGER.isLoggable(Level.FINE))
+ if(RAW_LOGGER.isDebugEnabled())
{
ByteBuffer dup = msg.duplicate();
byte[] data = new byte[dup.remaining()];
dup.get(data);
Binary bin = new Binary(data);
- RAW_LOGGER.fine("RECV[" + getRemoteAddress() + "] : " + bin.toString());
+ RAW_LOGGER.debug("RECV[" + getRemoteAddress() + "] : " + bin.toString());
}
_readBytes += msg.remaining();
switch(_state)
@@ -454,9 +470,14 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut
synchronized (_sendLock)
{
_lastWriteTime = System.currentTimeMillis();
- if (FRAME_LOGGER.isLoggable(Level.FINE))
+ if (FRAME_LOGGER.isDebugEnabled())
{
- FRAME_LOGGER.fine("SEND[" + getRemoteAddress() + "|" + amqFrame.getChannel() + "] : " + amqFrame.getFrameBody());
+ FRAME_LOGGER.debug("SEND["
+ + getRemoteAddress()
+ + "|"
+ + amqFrame.getChannel()
+ + "] : "
+ + amqFrame.getFrameBody());
}
_frameWriter.setValue(amqFrame);
@@ -472,13 +493,13 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut
dup.flip();
_writtenBytes += dup.limit();
- if (RAW_LOGGER.isLoggable(Level.FINE))
+ if (RAW_LOGGER.isDebugEnabled())
{
ByteBuffer dup2 = dup.duplicate();
byte[] data = new byte[dup2.remaining()];
dup2.get(data);
Binary bin = new Binary(data);
- RAW_LOGGER.fine("SEND[" + getRemoteAddress() + "] : " + bin.toString());
+ RAW_LOGGER.debug("SEND[" + getRemoteAddress() + "] : " + bin.toString());
}
_sender.send(dup);