Browse Source

Reduce logging for unsent SUBSCRIBE messages

Closes gh-28252
pull/33729/head
rstoyanchev 1 year ago
parent
commit
92c9b0dc97
  1. 10
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -366,10 +366,10 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE @@ -366,10 +366,10 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
logger.debug("Failed to send message to MessageChannel in session " + session.getId(), ex);
}
else if (logger.isErrorEnabled()) {
// Skip unsent CONNECT messages (likely auth issues)
if (!isConnect || sent) {
logger.error("Failed to send message to MessageChannel in session " + session.getId() +
":" + ex.getMessage());
// Skip for unsent CONNECT or SUBSCRIBE (likely authentication/authorization issues)
if (sent || !(isConnect || StompCommand.SUBSCRIBE.equals(command))) {
logger.error("Failed to send message to MessageChannel in session " +
session.getId() + ":" + ex.getMessage());
}
}
handleError(session, ex, message);

Loading…
Cancel
Save