Skip to content

Commit 9991649

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. Closes gh-26038
1 parent 103f57a commit 9991649

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
@@ -312,8 +312,13 @@ else if (StompCommand.UNSUBSCRIBE.equals(command)) {
312312
}
313313
catch (Throwable ex) {
314314
if (logger.isErrorEnabled()) {
315-
logger.error("Failed to send client message to application via MessageChannel" +
316-
" in session " + session.getId() + ". Sending STOMP ERROR to client.", ex);
315+
String errorText = "Failed to send message to MessageChannel in session " + session.getId();
316+
if (logger.isDebugEnabled()) {
317+
logger.debug(errorText, ex);
318+
}
319+
else {
320+
logger.error(errorText + ":" + ex.getMessage());
321+
}
317322
}
318323
handleError(session, ex, message);
319324
}

0 commit comments

Comments
 (0)