This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 7054b7b  Expand WebDocket client debug logging
7054b7b is described below

commit 7054b7b205c98262325005bd31d87567e2659dc1
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Sep 8 17:38:45 2020 +0100

    Expand WebDocket client debug logging
    
    Still trying to get to the bottom of some TestWebSocketFrameClient test
    failures. Currently logs suggest request is sent by client but not seen
    by server.
---
 java/org/apache/tomcat/websocket/LocalStrings.properties       | 2 ++
 java/org/apache/tomcat/websocket/WsWebSocketContainer.java     | 8 ++++++++
 test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 22e9f17..03b7923 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -128,6 +128,8 @@ wsSession.unknownHandlerType=Unable to add the message 
handler [{0}] as it was w
 wsWebSocketContainer.shutdown=The web application is stopping
 
 wsWebSocketContainer.asynchronousSocketChannelFail=Unable to open a connection 
to the server
+wsWebSocketContainer.connect.entry=Connecting endpoint instance of type [{0}] 
to [{1}]
+wsWebSocketContainer.connect.write=Writing the HTTP upgrade request from 
buffer starting at [{0}] with a limit of [{1}]
 wsWebSocketContainer.defaultConfiguratorFail=Failed to create the default 
configurator
 wsWebSocketContainer.endpointCreateFail=Failed to create a local endpoint of 
type [{0}]
 wsWebSocketContainer.failedAuthentication=Failed to handle HTTP response code 
[{0}]. Authentication header was not accepted by server.
diff --git a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
index c78da3c..2022182 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -203,6 +203,10 @@ public class WsWebSocketContainer implements 
WebSocketContainer, BackgroundProce
             Set<URI> redirectSet)
             throws DeploymentException {
 
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("wsWebSocketContainer.connect.entry", 
endpoint.getClass().getName(), path));
+        }
+
         boolean secure = false;
         ByteBuffer proxyConnect = null;
         URI proxyPath;
@@ -346,6 +350,10 @@ public class WsWebSocketContainer implements 
WebSocketContainer, BackgroundProce
             Future<Void> fHandshake = channel.handshake();
             fHandshake.get(timeout, TimeUnit.MILLISECONDS);
 
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("wsWebSocketContainer.connect.write",
+                        Integer.valueOf(request.position()), 
Integer.valueOf(request.limit())));
+            }
             writeRequest(channel, request, timeout);
 
             HttpResponse httpResponse = processResponse(response, channel, 
timeout);
diff --git a/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java 
b/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
index 615905c..aa7036a 100644
--- a/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
+++ b/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
@@ -118,6 +118,7 @@ public class TestWebSocketFrameClient extends 
WebSocketBaseTest {
         tomcat.start();
 
         
LogManager.getLogManager().getLogger("org.apache.coyote").setLevel(Level.ALL);
+        
LogManager.getLogManager().getLogger("org.apache.tomcat.websocket").setLevel(Level.ALL);
         
LogManager.getLogManager().getLogger("org.apache.tomcat.util.net").setLevel(Level.ALL);
         try {
             echoTester("",null);
@@ -127,6 +128,7 @@ public class TestWebSocketFrameClient extends 
WebSocketBaseTest {
             echoTester("/foo/",null);
         } finally {
             
LogManager.getLogManager().getLogger("org.apache.coyote").setLevel(Level.INFO);
+            
LogManager.getLogManager().getLogger("org.apache.tomcat.websocket.WsWebSocketContainer").setLevel(Level.INFO);
             
LogManager.getLogManager().getLogger("org.apache.tomcat.util.net").setLevel(Level.INFO);
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to