-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[dotnet] Sending GeckoDriver output to a log file. #16081
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
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
@nvborisenko is there a place where |
#15060 is a right direction to implement requested process flag. |
But how does it work? GeckoDriver has no flag to send the log output to a file. |
That is what the flag does in GeckoDriver. |
Surprise :) I propose to combine the unified approach for all driver services in #15785. Idea is pretty simple: capture stdout by default and redirect the messages to our |
What if the user wants logging to go to a file, but still wants to print to console? Hijacking stdout doesn't sound very nice. |
And my proposal covers this case. Even the case when user wants to redirect driver logs to any remote server in runtime. Currently in chrome:
|
I'd say .NET has done it correctly over time, which is using the flags provided to send output to a file. Java did the opposite which is taking all output from all drivers to a file. I would prefer to do exceptions on a case by case basis rather than making the exception the rule. I am not sure why Java did it that way, but here we are. When I create another PR to send logs to console (next item on #12273), we can use the |
This is good argument. But there is but. Tomorrow you will implement service.LogFile = "C://myfile.txt";
service.LogToConsole = true; I think it is impossible. |
We will follow the same logic Java has. If a path has been set for the log, that has priority. I will document that as well when the PR for log to console is there. |
Adding BUILD.bazel to run those tests in CI.
I added a test and also the bazel config to run it on RBE. Seems we are good so I will merge this tomorrow. |
AI reviewed your PR and concerns are absolutely correct. |
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
User description
🔗 Related Issues
Related to #12273
💥 What does this PR do?
This PR enables users to send GeckoDriver logs to a file.
🔧 Implementation Notes
I tried to avoid many changes and mostly touched the FirefoxDriverService class.
💡 Additional Considerations
I did run a test locally, and it works, but I did not find any section in the test suite where DriverService-related code is getting tested.
🔄 Types of changes
PR Type
Enhancement
Description
Add log file output capability for GeckoDriver
Enable redirection of driver process output to file
Implement async stream reading for log capture
Add proper resource disposal for log writer
Diagram Walkthrough
File Walkthrough
DriverService.cs
Make event methods virtual for inheritance
dotnet/src/webdriver/DriverService.cs
OnDriverProcessStarting
method virtualOnDriverProcessStarted
method virtualFirefoxDriverService.cs
Implement GeckoDriver log file output functionality
dotnet/src/webdriver/Firefox/FirefoxDriverService.cs
LogPath
property for log file configuration