ARTEMIS-1903 Log STOMP ERROR frames at WARN

Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5b7b84a1
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5b7b84a1
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5b7b84a1

Branch: refs/heads/master
Commit: 5b7b84a1b3e1eb4a78cc2e391e0c77baa7e983f2
Parents: c1b0f1e
Author: Justin Bertram <jbert...@apache.org>
Authored: Fri Jun 1 11:16:10 2018 -0500
Committer: Clebert Suconic <clebertsuco...@apache.org>
Committed: Mon Jun 4 12:01:02 2018 -0400

----------------------------------------------------------------------
 .../core/protocol/stomp/ActiveMQStompProtocolLogger.java     | 8 ++++++--
 .../artemis/core/protocol/stomp/StompConnection.java         | 8 ++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5b7b84a1/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompProtocolLogger.java
----------------------------------------------------------------------
diff --git 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompProtocolLogger.java
 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompProtocolLogger.java
index e9dc4ee..e9c431b 100644
--- 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompProtocolLogger.java
+++ 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompProtocolLogger.java
@@ -26,7 +26,7 @@ import org.jboss.logging.annotations.MessageLogger;
 /**
  * Logger Code 22
  *
- * each message id must be 6 digits long starting with 10, the 3rd digit 
donates the level so
+ * each message id must be 6 digits long starting with 22, the 3rd digit 
donates the level so
  *
  * INF0  1
  * WARN  2
@@ -35,7 +35,7 @@ import org.jboss.logging.annotations.MessageLogger;
  * TRACE 5
  * FATAL 6
  *
- * so an INFO message would be 101000 to 101999
+ * so an INFO message would be 241000 to 246999
  */
 
 @MessageLogger(projectCode = "AMQ")
@@ -50,6 +50,10 @@ public interface ActiveMQStompProtocolLogger extends 
BasicLogger {
    @Message(id = 222068, value = "connection closed {0}", format = 
Message.Format.MESSAGE_FORMAT)
    void connectionClosed(StompConnection connection);
 
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 222069, value = "Sent ERROR frame to STOMP client {0}: {1}", 
format = Message.Format.MESSAGE_FORMAT)
+   void sentErrorToClient(String address, String message);
+
    @LogMessage(level = Logger.Level.ERROR)
    @Message(id = 224023, value = "Unable to send frame {0}", format = 
Message.Format.MESSAGE_FORMAT)
    void errorSendingFrame(@Cause Exception e, StompFrame frame);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5b7b84a1/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
----------------------------------------------------------------------
diff --git 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
index 78cd21b..c247585 100644
--- 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
+++ 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
@@ -778,6 +778,14 @@ public final class StompConnection implements 
RemotingConnection {
          stompListener.replySent(frame);
       }
 
+      if (frame.getCommand().equals(Stomp.Responses.ERROR)) {
+         String message = "no message header";
+         if (frame.hasHeader(Stomp.Headers.Error.MESSAGE)) {
+            message = frame.getHeader(Stomp.Headers.Error.MESSAGE);
+         }
+         
ActiveMQStompProtocolLogger.LOGGER.sentErrorToClient(getTransportConnection().getRemoteAddress(),
 message);
+      }
+
    }
 
    public VersionedStompFrameHandler getFrameHandler() {

Reply via email to