Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion dotnet/src/webdriver/Internal/Logging/LogContextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ public LogContextManager()
{
var defaulLogHandler = new TextWriterHandler(Console.Error);

GlobalContext = new LogContext(LogEventLevel.Warn, null, null, [defaulLogHandler]);
// Enable debug logging if SE_DEBUG environment variable is set
var level = Environment.GetEnvironmentVariable("SE_DEBUG") is not null
? LogEventLevel.Debug
: LogEventLevel.Warn;

GlobalContext = new LogContext(level, null, null, [defaulLogHandler]);
}

public ILogContext GlobalContext { get; }
Expand Down
3 changes: 2 additions & 1 deletion java/src/org/openqa/selenium/internal/Debug.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public class Debug {
static {
boolean simpleProperty = Boolean.getBoolean("selenium.debug");
boolean longerProperty = Boolean.getBoolean("selenium.webdriver.verbose");
boolean envVar = Boolean.parseBoolean(System.getenv("SE_DEBUG"));

IS_DEBUG = simpleProperty || longerProperty;
IS_DEBUG = simpleProperty || longerProperty || envVar;
}

private Debug() {
Expand Down
6 changes: 6 additions & 0 deletions javascript/selenium-webdriver/lib/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,12 @@ class LogManager {

const logManager = new LogManager()

// Enable debug logging if SE_DEBUG or SELENIUM_VERBOSE environment variable is set
if (typeof process !== 'undefined' && process.env && (process.env.SE_DEBUG || process.env.SELENIUM_VERBOSE)) {
logManager.root_.setLevel(Level.ALL)
logManager.root_.addHandler(consoleHandler)
}

/**
* Retrieves a named logger, creating it in the process. This function will
* implicitly create the requested logger, and any of its parents, if they
Expand Down
6 changes: 0 additions & 6 deletions javascript/selenium-webdriver/lib/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

//const build = require('./build')
const fileserver = require('./fileserver')
const logging = require('selenium-webdriver/lib/logging')
const testing = require('selenium-webdriver/testing')

//const NO_BUILD = /^1|true$/i.test(process.env['SELENIUM_NO_BUILD'])
Expand Down Expand Up @@ -53,11 +52,6 @@ process.on('unhandledRejection', (reason) => {
console.error('Unhandled promise rejection:', reason)
})

if (/^1|true$/i.test(process.env['SELENIUM_VERBOSE'])) {
logging.installConsoleHandler()
logging.getLogger(`${logging.Type.DRIVER}.http`).setLevel(logging.Level.ALL)
}

testing.init()

before(function () {
Expand Down
10 changes: 10 additions & 0 deletions py/selenium/webdriver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
# specific language governing permissions and limitations
# under the License.

import logging
import os

# Enable debug logging if SE_DEBUG environment variable is set
if os.environ.get("SE_DEBUG"):
logger = logging.getLogger("selenium")
logger.setLevel(logging.DEBUG)
if not logger.handlers:
logger.addHandler(logging.StreamHandler())

from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.chrome.webdriver import WebDriver as Chrome
Expand Down
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def self.for(*)
#

def self.logger(**)
level = $DEBUG || ENV.key?('DEBUG') ? :debug : :info
level = $DEBUG || ENV.key?('DEBUG') || ENV.key?('SE_DEBUG') ? :debug : :info
@logger ||= WebDriver::Logger.new('Selenium', default_level: level, **)
end
end # WebDriver
Expand Down