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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 0b82e0d  Expand WebDocket client debug logging
0b82e0d is described below

commit 0b82e0d5e4aec45976e671d97dacad3f52ad89aa
Author: Mark Thomas <ma...@apache.org>
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 702c866..4949759 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -202,6 +202,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;
@@ -345,6 +349,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 7dc5f4c..73fe483 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: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to