Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet] Add more internal logs around CDP DevTools communication #14558

Merged
merged 6 commits into from
Oct 4, 2024

Conversation

nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Oct 3, 2024

User description

Description

Just added internal logging for DevToolsSession class.

Motivation and Context

To be able analyze what is happening in CDP when users report issues related to CDP communication.
Related to #14547

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

enhancement, other


Description

  • Added internal logging to the DevToolsSession class to trace CDP communications, improving the ability to analyze issues related to CDP.
  • Introduced trace logging for both sending and receiving CDP messages, providing detailed insights into the communication process.
  • Implemented error handling with logging for unhandled exceptions in event handlers, enhancing robustness and debugging capabilities.

Changes walkthrough 📝

Relevant files
Enhancement
DevToolsSession.cs
Enhance CDP DevToolsSession with internal logging and error handling

dotnet/src/webdriver/DevTools/DevToolsSession.cs

  • Added internal logging for CDP communication using ILogger.
  • Implemented trace logging for sending and receiving CDP messages.
  • Added error handling with logging for unhandled exceptions in event
    handlers.
  • +25/-1   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    qodo-merge-pro bot commented Oct 3, 2024

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling
    The new error handling in the event dispatch might swallow exceptions without proper handling or notification to the user.

    Logging Consistency
    The PR introduces new logging using ILogger, but also keeps the existing LogTrace method. This might lead to inconsistent logging practices.

    Copy link
    Contributor

    qodo-merge-pro bot commented Oct 3, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Error handling
    Use more specific exception types for better error handling and logging

    Consider using a more specific exception type in the catch block instead of catching
    all exceptions. This allows for more precise error handling and can help identify
    specific issues more easily.

    dotnet/src/webdriver/DevTools/DevToolsSession.cs [605-608]

    +catch (InvalidOperationException ex)
    +{
    +    logger.Warn($"CDP VNT ^^ Invalid operation in event handler of '{method}' method. {ex.Message}");
    +}
     catch (Exception ex)
     {
    -    logger.Warn($"CDP VNT ^^ Unhandled error occured in event handler of '{method}' method. {ex}");
    +    logger.Error($"CDP VNT ^^ Unhandled error occurred in event handler of '{method}' method. {ex}");
     }
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Catching more specific exceptions allows for precise error handling and can help identify specific issues more easily. This suggestion improves the robustness of error handling.

    8
    Enhancement
    Use string interpolation instead of string.Format for improved readability and performance

    Consider using string interpolation instead of string.Format for better readability
    and performance. Replace the LogTrace call with an interpolated string.

    dotnet/src/webdriver/DevTools/DevToolsSession.cs [283]

    -LogTrace("Sending {0} {1}: {2}", message.CommandId, message.CommandName, commandParameters.ToString());
    +LogTrace($"Sending {message.CommandId} {message.CommandName}: {commandParameters}");
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion to use string interpolation enhances readability and can improve performance by reducing the overhead associated with string.Format. This is a valid and beneficial change.

    7
    Performance
    Use a guard clause to avoid unnecessary string concatenation when logging is disabled

    Consider using a guard clause to check if the logger is enabled before constructing
    the log message. This can improve performance by avoiding unnecessary string
    concatenation when logging is disabled.

    dotnet/src/webdriver/DevTools/DevToolsSession.cs [551-554]

    -if (logger.IsEnabled(LogEventLevel.Trace))
    -{
    -    logger.Trace($"CDP RCV << {message}");
    -}
    +if (!logger.IsEnabled(LogEventLevel.Trace))
    +    return;
     
    +logger.Trace($"CDP RCV << {message}");
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: The guard clause can improve performance by preventing unnecessary string operations when logging is disabled. This is a reasonable optimization, though its impact may be limited.

    6
    Use a constant for logger name to improve performance

    Consider using a constant or readonly field for the logger name instead of using a
    generic type parameter. This can improve performance by avoiding runtime type
    lookups.

    dotnet/src/webdriver/DevTools/DevToolsSession.cs [60]

    -private readonly static ILogger logger = Internal.Logging.Log.GetLogger<DevToolsSession>();
    +private const string LoggerName = "DevToolsSession";
    +private readonly static ILogger logger = Internal.Logging.Log.GetLogger(LoggerName);
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: Using a constant for the logger name can slightly improve performance by avoiding runtime type lookups. However, the impact is minimal, so the suggestion is moderately useful.

    5

    💡 Need additional feedback ? start a PR chat

    @nvborisenko
    Copy link
    Member Author

    After:

     23:01:25.780 TRACE DevToolsSession: CDP SND >> 1 Target.getTargets: {}
    23:01:25.788 TRACE DevToolsSession: CDP RCV << {"id":1,"result":{"targetInfos":[{"targetId":"EAAFECABC80E4474492DCB45B887E41F","type":"page","title":"data:,","url":"data:,","attached":true,"canAccessOpener":false,"browserContextId":"6E997F0CDEEDDFA0A188E1822CFACD3C"}]}}
    23:01:25.798 TRACE DevToolsSession: CDP SND >> 2 Target.attachToTarget: {"targetId":"EAAFECABC80E4474492DCB45B887E41F","flatten":true}
    23:01:25.799 TRACE DevToolsSession: CDP RCV << {"method":"Target.attachedToTarget","params":{"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1","targetInfo":{"targetId":"EAAFECABC80E4474492DCB45B887E41F","type":"page","title":"data:,","url":"data:,","attached":true,"canAccessOpener":false,"browserContextId":"6E997F0CDEEDDFA0A188E1822CFACD3C"},"waitingForDebugger":false}}
    23:01:25.799 TRACE DevToolsSession: CDP RCV << {"id":2,"result":{"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}}
    23:01:25.801 TRACE DevToolsSession: CDP SND >> 3 Target.setAutoAttach: {"autoAttach":true,"waitForDebuggerOnStart":false,"flatten":true}
    23:01:25.802 TRACE DevToolsSession: CDP RCV << {"id":3,"result":{},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.806 TRACE DevToolsSession: CDP SND >> 4 Log.clear: {}
    23:01:25.808 TRACE DevToolsSession: CDP RCV << {"id":4,"result":{},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.817 TRACE DevToolsSession: CDP SND >> 5 Network.enable: {}
    23:01:25.818 TRACE DevToolsSession: CDP RCV << {"id":5,"result":{},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.820 DEBUG HttpCommandExecutor: Executing command: [4458710eb9aa7bdefe8f3fb74f2cdc6c]: get {"url":"http://localhost:50952/common/postForm.html"}
    23:01:25.821 TRACE HttpCommandExecutor: >> POST RequestUri: http://localhost:50954/session/4458710eb9aa7bdefe8f3fb74f2cdc6c/url, Content: System.Net.Http.ByteArrayContent, Headers: 2
    {"url":"http://localhost:50952/common/postForm.html"}
    23:01:25.832 TRACE DevToolsSession: CDP RCV << {"method":"Network.requestWillBeSent","params":{"requestId":"5950FA58FF8F5F707BD41D9C21F453BA","loaderId":"5950FA58FF8F5F707BD41D9C21F453BA","documentURL":"http://localhost:50952/common/postForm.html","request":{"url":"http://localhost:50952/common/postForm.html","method":"GET","headers":{"Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36","sec-ch-ua":"\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"Windows\""},"mixedContentType":"none","initialPriority":"VeryHigh","referrerPolicy":"strict-origin-when-cross-origin","isSameSite":true},"timestamp":521856.331758,"wallTime":1727985685.831455,"initiator":{"type":"other"},"redirectHasExtraInfo":false,"type":"Document","frameId":"EAAFECABC80E4474492DCB45B887E41F","hasUserGesture":false},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.835 TRACE DevToolsSession: CDP RCV << {"method":"Network.requestWillBeSentExtraInfo","params":{"requestId":"5950FA58FF8F5F707BD41D9C21F453BA","associatedCookies":[],"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Accept-Encoding":"gzip, deflate, br, zstd","Accept-Language":"en-US,en;q=0.9","Connection":"keep-alive","Host":"localhost:50952","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36","sec-ch-ua":"\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"Windows\""},"connectTiming":{"requestTime":521856.332524},"siteHasCookieInOtherPartition":false},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.841 TRACE DevToolsSession: CDP RCV << {"method":"Network.responseReceivedExtraInfo","params":{"requestId":"5950FA58FF8F5F707BD41D9C21F453BA","blockedCookies":[],"headers":{"Content-Type":"text/html","content-length":"310"},"resourceIPAddressSpace":"Local","statusCode":200,"headersText":"HTTP/1.1 200 OK\r\ncontent-length: 310\r\nContent-Type: text/html\r\n\r\n","cookiePartitionKey":{"topLevelSite":"http://localhost","hasCrossSiteAncestor":false},"cookiePartitionKeyOpaque":false,"exemptedCookies":[]},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.841 TRACE DevToolsSession: CDP RCV << {"method":"Network.responseReceived","params":{"requestId":"5950FA58FF8F5F707BD41D9C21F453BA","loaderId":"5950FA58FF8F5F707BD41D9C21F453BA","timestamp":521856.341463,"type":"Document","response":{"url":"http://localhost:50952/common/postForm.html","status":200,"statusText":"OK","headers":{"Content-Type":"text/html","content-length":"310"},"mimeType":"text/html","charset":"","connectionReused":true,"connectionId":44,"remoteIPAddress":"[::1]","remotePort":50952,"fromDiskCache":false,"fromServiceWorker":false,"fromPrefetchCache":false,"encodedDataLength":65,"timing":{"requestTime":521856.332524,"proxyStart":-1,"proxyEnd":-1,"dnsStart":-1,"dnsEnd":-1,"connectStart":-1,"connectEnd":-1,"sslStart":-1,"sslEnd":-1,"workerStart":-1,"workerReady":-1,"workerFetchStart":-1,"workerRespondWithSettled":-1,"sendStart":0.546,"sendEnd":0.659,"pushStart":0,"pushEnd":0,"receiveHeadersStart":7.696,"receiveHeadersEnd":7.984},"responseTime":1.727985685839624e+12,"protocol":"http/1.1","alternateProtocolUsage":"unspecifiedReason","securityState":"secure"},"hasExtraInfo":true,"frameId":"EAAFECABC80E4474492DCB45B887E41F"},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.855 TRACE DevToolsSession: CDP RCV << {"method":"Network.policyUpdated","params":{},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.859 TRACE DevToolsSession: CDP RCV << {"method":"Network.dataReceived","params":{"requestId":"5950FA58FF8F5F707BD41D9C21F453BA","timestamp":521856.347734,"dataLength":310,"encodedDataLength":0},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.859 TRACE DevToolsSession: CDP RCV << {"method":"Network.loadingFinished","params":{"requestId":"5950FA58FF8F5F707BD41D9C21F453BA","timestamp":521856.340959,"encodedDataLength":375},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.876 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 1
    23:01:25.877 DEBUG HttpCommandExecutor: Response: ( Success: )
    23:01:25.878 TRACE DevToolsSession: CDP RCV << {"method":"Network.requestWillBeSent","params":{"requestId":"10360.2","loaderId":"5950FA58FF8F5F707BD41D9C21F453BA","documentURL":"http://localhost:50952/common/postForm.html","request":{"url":"http://localhost:50952/favicon.ico","method":"GET","headers":{"sec-ch-ua-platform":"\"Windows\"","Referer":"http://localhost:50952/common/postForm.html","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36","sec-ch-ua":"\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"","sec-ch-ua-mobile":"?0"},"mixedContentType":"none","initialPriority":"High","referrerPolicy":"strict-origin-when-cross-origin","isSameSite":true},"timestamp":521856.376005,"wallTime":1727985685.875298,"initiator":{"type":"other"},"redirectHasExtraInfo":false,"type":"Other","frameId":"EAAFECABC80E4474492DCB45B887E41F","hasUserGesture":false},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.878 TRACE DevToolsSession: CDP RCV << {"method":"Network.requestWillBeSentExtraInfo","params":{"requestId":"10360.2","associatedCookies":[],"headers":{"Accept":"image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8","Accept-Encoding":"gzip, deflate, br, zstd","Accept-Language":"en-US,en;q=0.9","Connection":"keep-alive","Host":"localhost:50952","Referer":"http://localhost:50952/common/postForm.html","Sec-Fetch-Dest":"image","Sec-Fetch-Mode":"no-cors","Sec-Fetch-Site":"same-origin","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36","sec-ch-ua":"\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"Windows\""},"connectTiming":{"requestTime":521856.37662},"clientSecurityState":{"initiatorIsSecureContext":true,"initiatorIPAddressSpace":"Local","privateNetworkRequestPolicy":"PreflightWarn"},"siteHasCookieInOtherPartition":false},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.878 DEBUG HttpCommandExecutor: Executing command: [4458710eb9aa7bdefe8f3fb74f2cdc6c]: findElement {"using":"xpath","value":"//form/input"}
    23:01:25.879 TRACE HttpCommandExecutor: >> POST RequestUri: http://localhost:50954/session/4458710eb9aa7bdefe8f3fb74f2cdc6c/element, Content: System.Net.Http.ByteArrayContent, Headers: 2
    {"using":"xpath","value":"//form/input"}
    23:01:25.894 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 1
    23:01:25.894 DEBUG HttpCommandExecutor: Response: ( Success: System.Collections.Generic.Dictionary`2[System.String,System.Object])
    23:01:25.895 DEBUG HttpCommandExecutor: Executing command: [4458710eb9aa7bdefe8f3fb74f2cdc6c]: clickElement {"id":"f.EAAFECABC80E4474492DCB45B887E41F.d.5950FA58FF8F5F707BD41D9C21F453BA.e.4"}
    23:01:25.896 TRACE HttpCommandExecutor: >> POST RequestUri: http://localhost:50954/session/4458710eb9aa7bdefe8f3fb74f2cdc6c/element/f.EAAFECABC80E4474492DCB45B887E41F.d.5950FA58FF8F5F707BD41D9C21F453BA.e.4/click, Content: System.Net.Http.ByteArrayContent, Headers: 2
    {}
    23:01:25.905 TRACE DevToolsSession: CDP RCV << {"method":"Network.responseReceivedExtraInfo","params":{"requestId":"10360.2","blockedCookies":[],"headers":{"content-length":"142"},"resourceIPAddressSpace":"Local","statusCode":404,"headersText":"HTTP/1.1 404 Not Found\r\ncontent-length: 142\r\n\r\n","cookiePartitionKey":{"topLevelSite":"http://localhost","hasCrossSiteAncestor":false},"cookiePartitionKeyOpaque":false,"exemptedCookies":[]},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.906 TRACE DevToolsSession: CDP RCV << {"method":"Network.responseReceived","params":{"requestId":"10360.2","loaderId":"5950FA58FF8F5F707BD41D9C21F453BA","timestamp":521856.405214,"type":"Other","response":{"url":"http://localhost:50952/favicon.ico","status":404,"statusText":"Not Found","headers":{"content-length":"142"},"mimeType":"text/plain","charset":"","connectionReused":true,"connectionId":44,"remoteIPAddress":"[::1]","remotePort":50952,"fromDiskCache":false,"fromServiceWorker":false,"fromPrefetchCache":false,"encodedDataLength":47,"timing":{"requestTime":521856.37662,"proxyStart":-1,"proxyEnd":-1,"dnsStart":-1,"dnsEnd":-1,"connectStart":-1,"connectEnd":-1,"sslStart":-1,"sslEnd":-1,"workerStart":-1,"workerReady":-1,"workerFetchStart":-1,"workerRespondWithSettled":-1,"sendStart":0.652,"sendEnd":0.747,"pushStart":0,"pushEnd":0,"receiveHeadersStart":27.765,"receiveHeadersEnd":27.913},"responseTime":1.727985685903789e+12,"protocol":"http/1.1","alternateProtocolUsage":"unspecifiedReason","securityState":"secure"},"hasExtraInfo":true,"frameId":"EAAFECABC80E4474492DCB45B887E41F"},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.906 TRACE DevToolsSession: CDP RCV << {"method":"Network.dataReceived","params":{"requestId":"10360.2","timestamp":521856.405334,"dataLength":142,"encodedDataLength":0},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.906 TRACE DevToolsSession: CDP RCV << {"method":"Network.loadingFinished","params":{"requestId":"10360.2","timestamp":521856.4049,"encodedDataLength":189},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.987 TRACE DevToolsSession: CDP RCV << {"method":"Network.requestWillBeSent","params":{"requestId":"4EBA21859B10E15E160BC62CABC0A3D6","loaderId":"4EBA21859B10E15E160BC62CABC0A3D6","documentURL":"http://localhost:50952/common/resultPage.html","request":{"url":"http://localhost:50952/common/resultPage.html","method":"POST","headers":{"Content-Type":"application/x-www-form-urlencoded","Origin":"http://localhost:50952","Referer":"http://localhost:50952/common/postForm.html","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36","sec-ch-ua":"\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"Windows\""},"postData":"redirect=one","hasPostData":true,"postDataEntries":[{"bytes":"cmVkaXJlY3Q9b25l"}],"mixedContentType":"none","initialPriority":"VeryHigh","referrerPolicy":"strict-origin-when-cross-origin","isSameSite":true},"timestamp":521856.445617,"wallTime":1727985685.945326,"initiator":{"type":"other"},"redirectHasExtraInfo":false,"type":"Document","frameId":"EAAFECABC80E4474492DCB45B887E41F","hasUserGesture":true},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.987 TRACE DevToolsSession: CDP RCV << {"method":"Network.requestWillBeSentExtraInfo","params":{"requestId":"4EBA21859B10E15E160BC62CABC0A3D6","associatedCookies":[],"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Accept-Encoding":"gzip, deflate, br, zstd","Accept-Language":"en-US,en;q=0.9","Cache-Control":"max-age=0","Connection":"keep-alive","Content-Length":"12","Content-Type":"application/x-www-form-urlencoded","Host":"localhost:50952","Origin":"http://localhost:50952","Referer":"http://localhost:50952/common/postForm.html","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"same-origin","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36","sec-ch-ua":"\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"Windows\""},"connectTiming":{"requestTime":521856.446166},"clientSecurityState":{"initiatorIsSecureContext":true,"initiatorIPAddressSpace":"Local","privateNetworkRequestPolicy":"Allow"},"siteHasCookieInOtherPartition":false},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.988 TRACE DevToolsSession: CDP RCV << {"method":"Network.responseReceivedExtraInfo","params":{"requestId":"4EBA21859B10E15E160BC62CABC0A3D6","blockedCookies":[],"headers":{"content-length":"159"},"resourceIPAddressSpace":"Local","statusCode":404,"headersText":"HTTP/1.1 404 Not Found\r\ncontent-length: 159\r\n\r\n","cookiePartitionKey":{"topLevelSite":"http://localhost","hasCrossSiteAncestor":false},"cookiePartitionKeyOpaque":false,"exemptedCookies":[]},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.988 TRACE DevToolsSession: CDP RCV << {"method":"Network.responseReceived","params":{"requestId":"4EBA21859B10E15E160BC62CABC0A3D6","loaderId":"4EBA21859B10E15E160BC62CABC0A3D6","timestamp":521856.454774,"type":"Document","response":{"url":"http://localhost:50952/common/resultPage.html","status":404,"statusText":"Not Found","headers":{"content-length":"159"},"mimeType":"text/plain","charset":"","connectionReused":true,"connectionId":44,"remoteIPAddress":"[::1]","remotePort":50952,"fromDiskCache":false,"fromServiceWorker":false,"fromPrefetchCache":false,"encodedDataLength":47,"timing":{"requestTime":521856.446166,"proxyStart":-1,"proxyEnd":-1,"dnsStart":-1,"dnsEnd":-1,"connectStart":-1,"connectEnd":-1,"sslStart":-1,"sslEnd":-1,"workerStart":-1,"workerReady":-1,"workerFetchStart":-1,"workerRespondWithSettled":-1,"sendStart":0.867,"sendEnd":0.949,"pushStart":0,"pushEnd":0,"receiveHeadersStart":7.864,"receiveHeadersEnd":8.004},"responseTime":1.727985685953434e+12,"protocol":"http/1.1","alternateProtocolUsage":"unspecifiedReason","securityState":"secure"},"hasExtraInfo":true,"frameId":"EAAFECABC80E4474492DCB45B887E41F"},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.988 TRACE DevToolsSession: CDP RCV << {"method":"Network.policyUpdated","params":{},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.988 TRACE DevToolsSession: CDP RCV << {"method":"Network.dataReceived","params":{"requestId":"4EBA21859B10E15E160BC62CABC0A3D6","timestamp":521856.458352,"dataLength":159,"encodedDataLength":0},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.988 TRACE DevToolsSession: CDP RCV << {"method":"Network.loadingFinished","params":{"requestId":"4EBA21859B10E15E160BC62CABC0A3D6","timestamp":521856.454425,"encodedDataLength":206},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:25.988 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 1
    23:01:25.988 DEBUG HttpCommandExecutor: Response: ( Success: )
    23:01:25.991 TRACE DevToolsSession: CDP SND >> 6 Network.getRequestPostData: {"requestId":"4EBA21859B10E15E160BC62CABC0A3D6"}
    23:01:25.999 TRACE DevToolsSession: CDP RCV << {"id":6,"result":{"postData":"redirect=one"},"sessionId":"A9F45B313B9EFE3A8237DF535DED85B1"}
    23:01:26.020 DEBUG HttpCommandExecutor: Executing command: [4458710eb9aa7bdefe8f3fb74f2cdc6c]: quit {}
    23:01:26.021 TRACE HttpCommandExecutor: >> DELETE RequestUri: http://localhost:50954/session/4458710eb9aa7bdefe8f3fb74f2cdc6c, Content: null, Headers: 2
    23:01:26.055 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 1
    23:01:26.055 DEBUG HttpCommandExecutor: Response: ( Success: )
    

    For sure user doesn't see it if he it didn't enable explicitly.

    @pujagani
    Copy link
    Contributor

    pujagani commented Oct 4, 2024

    LGTM since it is opt-in. We can always ask users to enable logging when they report issues.

    @nvborisenko nvborisenko merged commit 50193fd into SeleniumHQ:trunk Oct 4, 2024
    8 of 10 checks passed
    @nvborisenko nvborisenko deleted the dotnet-cdp-logs branch October 4, 2024 11:41
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants