[java][rb][py][dotnet][js] use SE_DEBUG to enable debugging#16816
[java][rb][py][dotnet][js] use SE_DEBUG to enable debugging#16816titusfortner merged 2 commits intotrunkfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
asolntsev
left a comment
There was a problem hiding this comment.
@titusfortner This specific PR doesn't make things worse, so we can merge it.
At least in Java bindings, it adds env var "SE_DEBUG" as an alternative to the existing system property "selenium.debug".
But generally, this approach is totally wrong.
Instead of
writing "debug" or "info" log depending on the env var,
we should
always write "debug" log.
And depending on the env var, such a log should be written to file/console or ignored.
This is how logging works, at least in Java world.
|
Seems |
|
@asolntsev we do that in our test suite with @nvborisenko each language has idiomatic ways to customize exactly what is logged at what level. For this, we're looking for a common way to get the info most people are looking for that is good enough. |
navin772
left a comment
There was a problem hiding this comment.
LGTM for the python part.
Few minor improvements:
- Addressing the AI bot's
Cache logger instancesuggestion is a good idea. - Do we document the added
SE_DEBUGenv var anywhere? If not, we should add it to README
|
@navin772 thanks! Yes, we should update it here: https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/ |
User description
Most of the languages have different environment variables / system properties to enable debugging, this adds to whatever currently exists the ability to get the same functionality by setting the environment variable. Should be another option in troubleshooting to just tell people to run with the env set, or when running bazel add a quick
--test_env=DEBUG=1This standardizes on our
SE_*convention, and is what Rust/Selenium Manager already use.JS, I'm moving it from testing to lib, and opening it to all driver, not just http (doesn't seem to be that much more noise.
PR Type
Enhancement
Description
Standardize debugging across all language bindings using SE_DEBUG environment variable
Add SE_DEBUG support to Java, Python, Ruby, .NET, and JavaScript
Move JavaScript debug logging from test utilities to main logging library
Enable debug logging automatically when SE_DEBUG environment variable is set
Diagram Walkthrough
File Walkthrough
Debug.java
Add SE_DEBUG environment variable support to Javajava/src/org/openqa/selenium/internal/Debug.java
properties
LogContextManager.cs
Add SE_DEBUG environment variable support to .NETdotnet/src/webdriver/Internal/Logging/LogContextManager.cs
Warn
logging.js
Add SE_DEBUG support to JavaScript logging libraryjavascript/selenium-webdriver/lib/logging.js
LogManager initialization
variable is set
compatibility
__init__.py
Add SE_DEBUG environment variable support to Pythonpy/selenium/webdriver/init.py
SE_DEBUG is set
webdriver.rb
Add SE_DEBUG environment variable support to Rubyrb/lib/selenium/webdriver.rb
index.js
Remove debug setup from test utilitiesjavascript/selenium-webdriver/lib/test/index.js