Skip to content

Commit 010d094

Browse files
committed
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
1 parent 5b06c23 commit 010d094

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,13 @@ else if (StompCommand.UNSUBSCRIBE.equals(command)) {
326326
}
327327
catch (Throwable ex) {
328328
if (logger.isErrorEnabled()) {
329-
logger.error("Failed to send client message to application via MessageChannel" +
330-
" in session " + session.getId() + ". Sending STOMP ERROR to client.", ex);
329+
String errorText = "Failed to send message to MessageChannel in session " + session.getId();
330+
if (logger.isDebugEnabled()) {
331+
logger.debug(errorText, ex);
332+
}
333+
else {
334+
logger.error(errorText + ":" + ex.getMessage());
335+
}
331336
}
332337
handleError(session, ex, message);
333338
}

0 commit comments

Comments
 (0)