Browse Source

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
pull/26044/head
Rossen Stoyanchev 4 years ago
parent
commit
17dd7785f6
  1. 9
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java

9
spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java

@ -328,8 +328,13 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE @@ -328,8 +328,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);
}

Loading…
Cancel
Save