ARTEMIS-1903 Log STOMP ERROR frames at WARN

This commit is contained in:
Justin Bertram 2018-06-01 11:16:10 -05:00 committed by Clebert Suconic
parent c1b0f1eb85
commit 5b7b84a1b3
2 changed files with 14 additions and 2 deletions

View File

@ -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);

View File

@ -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() {