You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2024/08/07 16:23:40 UTC
(tomcat) 01/03: Add trace logging for receipt of WebSocket session close message
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 248827a857605809543e077246b2be70ba6faf11
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Aug 7 16:04:22 2024 +0100
Add trace logging for receipt of WebSocket session close message
---
java/org/apache/tomcat/websocket/LocalStrings.properties | 1 +
java/org/apache/tomcat/websocket/WsSession.java | 3 +++
2 files changed, 4 insertions(+)
diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 0f6b97186a..bca88fd110 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -130,6 +130,7 @@ wsSession.instanceCreateFailed=Endpoint instance creation failed
wsSession.instanceNew=Endpoint instance registration failed
wsSession.invalidHandlerTypePong=A pong message handler must implement MessageHandler.Whole
wsSession.messageFailed=Unable to write the complete message as the WebSocket connection has been closed
+wsSession.onClose.entry=Close message with reason [{0}] received for session [{1}] in state [{2}]
wsSession.removeHandlerFailed=Unable to remove the handler [{0}] as it was not registered with this session
wsSession.sendCloseFail=Failed to send close message for session [{0}] to remote endpoint
wsSession.unknownHandler=Unable to add the message handler [{0}] as it was for the unrecognised type [{1}]
diff --git a/java/org/apache/tomcat/websocket/WsSession.java b/java/org/apache/tomcat/websocket/WsSession.java
index 5385cf038c..76e2799f1e 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -621,6 +621,9 @@ public class WsSession implements Session {
* @param closeReason The reason contained within the received close message.
*/
public void onClose(CloseReason closeReason) {
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("wsSession.onClose.entry", closeReason, getId(), state));
+ }
if (state.compareAndSet(State.OPEN, State.CLOSING)) {
// Standard close.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org