Refine logging in StompErrorHandler

Avoid a full stacktrace at ERROR level for a client message that could
not be sent to a MessageChannel.

Closes gh-26038
This commit is contained in:
Rossen Stoyanchev
2020-11-05 21:34:56 +00:00
parent 103f57a0a6
commit 9991649216

View File

@@ -312,8 +312,13 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
}
catch (Throwable ex) {
if (logger.isErrorEnabled()) {
logger.error("Failed to send client message to application via MessageChannel" +
" in session " + session.getId() + ". Sending STOMP ERROR to client.", ex);
String errorText = "Failed to send message to MessageChannel in session " + session.getId();
if (logger.isDebugEnabled()) {
logger.debug(errorText, ex);
}
else {
logger.error(errorText + ":" + ex.getMessage());
}
}
handleError(session, ex, message);
}