Refine logging in StompErrorHandler

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

See gh-26026
This commit is contained in:
Rossen Stoyanchev 2020-11-05 21:34:56 +00:00
parent 21f9d05bd9
commit 17dd7785f6
1 changed files with 7 additions and 2 deletions

View File

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