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 2015/01/26 14:10:55 UTC

svn commit: r1654785 - in /tomcat/trunk/java/org/apache/tomcat/websocket: LocalStrings.properties WsSession.java

Author: markt
Date: Mon Jan 26 13:10:54 2015
New Revision: 1654785

URL: http://svn.apache.org/r1654785
Log:
Add some debug logging to the WebSocket session to track creation and closure

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
    tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1654785&r1=1654784&r2=1654785&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Mon Jan 26 13:10:54 2015
@@ -87,13 +87,15 @@ wsRemoteEndpoint.tooMuchData=Ping or pon
 wsSession.timeout=The WebSocket session timeout expired
 
 wsSession.closed=The WebSocket session [{0}] has been closed and no method (apart from close()) may be called on a closed session
+wsSession.created=Created WebSocket session [{0}]
+wsSession.doClose=Closing WebSocket session [{1}]
 wsSession.duplicateHandlerBinary=A binary message handler has already been configured
 wsSession.duplicateHandlerPong=A pong message handler has already been configured
 wsSession.duplicateHandlerText=A text message handler has already been configured
 wsSession.invalidHandlerTypePong=A pong message handler must implement MessageHandler.Basic
 wsSession.flushFailOnClose=Failed to flush batched messages on session close
 wsSession.messageFailed=Unable to write the complete message as the WebSocket connection has been closed
-wsSession.sendCloseFail=Failed to send close message to remote endpoint
+wsSession.sendCloseFail=Failed to send close message for session [{0}] to remote endpoint
 wsSession.removeHandlerFailed=Unable to remove the handler [{0}] as it was not registered with this session
 wsSession.unknownHandler=Unable to add the message handler [{0}] as it was for the unrecognised type [{1}]
 wsSession.unknownHandlerType=Unable to add the message handler [{0}] as it was wrapped as the unrecognised type [{1}]

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1654785&r1=1654784&r2=1654785&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Mon Jan 26 13:10:54 2015
@@ -179,6 +179,10 @@ public class WsSession implements Sessio
 
         this.userProperties.putAll(endpointConfig.getUserProperties());
         this.id = Long.toHexString(ids.getAndIncrement());
+
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("wsSession.created", id));
+        }
     }
 
 
@@ -459,6 +463,9 @@ public class WsSession implements Sessio
                 return;
             }
 
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("wsSession.doClose", id));
+            }
             try {
                 wsRemoteEndpoint.setBatchingAllowed(false);
             } catch (IOException e) {
@@ -566,7 +573,7 @@ public class WsSession implements Sessio
             // Failed to send close message. Close the socket and let the caller
             // deal with the Exception
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("wsSession.sendCloseFail"), ioe);
+                log.debug(sm.getString("wsSession.sendCloseFail", id), ioe);
             }
             wsRemoteEndpoint.close();
             // Failure to send a close message is not unexpected in the case of



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org