From f2ad8eba34196a1e32bdd58b3b94a214b4b3653e Mon Sep 17 00:00:00 2001
From: Erich Duda <eduda@redhat.com>
Date: Tue, 15 Aug 2017 14:10:20 +0200
Subject: [PATCH] Added logging

---
 .../activemq/artemis/core/client/impl/ClientConsumerImpl.java     | 8 +++++++-
 .../activemq/artemis/core/client/impl/ClientSessionImpl.java      | 3 +++
 .../apache/activemq/artemis/spi/core/remoting/SessionContext.java | 6 ++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
index f937c40..5b31348 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
@@ -504,7 +504,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
    @Override
    public void clearAtFailover() {
       if (logger.isTraceEnabled()) {
-         logger.trace(this + "::ClearAtFailover");
+         logger.trace(this + "::ClearAtFailover", new Throwable("trace"));
       }
       clearBuffer();
 
@@ -586,14 +586,20 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
       }
 
       // Add it to the buffer
+      logger.tracef("Adding message=%s to buffer.", message);
       buffer.addTail(message, message.getPriority());
+      logger.tracef("Checking handler=%s for message=%s", handler, message);
 
       if (handler != null) {
          // Execute using executor
          if (!stopped) {
+            logger.tracef("Queueing executor for message=%s", message);
             queueExecutor();
+         } else {
+            logger.tracef("Executor was not queued because consumer is stopped. Message=%s", message);
          }
       } else {
+         logger.tracef("Executor was not queued because handler is null. Message=%s", message);
          notify();
       }
    }
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
index d5a867d..6706688 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
@@ -811,7 +811,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
       ClientConsumerInternal consumer = getConsumer(consumerID);
 
       if (consumer != null) {
+         logger.tracef("Calling consumer.handleMessage for message=%s", message);
          consumer.handleMessage(message);
+      } else {
+         logger.tracef("Consumer is null for consumerId=%s and message=%s", consumerID, message);
       }
    }
 
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
index 1f15cc6..a424436 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
@@ -36,9 +36,12 @@ import org.apache.activemq.artemis.core.message.impl.MessageInternal;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.utils.IDGenerator;
 import org.apache.activemq.artemis.utils.SimpleIDGenerator;
+import org.jboss.logging.Logger;
 
 public abstract class SessionContext {
 
+   private static final Logger log = Logger.getLogger(SessionContext.class);
+
    protected ClientSessionInternal session;
 
    protected SendAcknowledgementHandler sendAckHandler;
@@ -96,7 +99,10 @@ public abstract class SessionContext {
 
       ClientSessionInternal session = this.session;
       if (session != null) {
+         log.tracef("Calling handleReceiveMessage for message=%s", message);
          session.handleReceiveMessage(consumerID, message);
+      } else {
+         log.tracef("Session is null for message=%s", message);
       }
    }
 
-- 
2.9.5

