Skip to content

Commit ce2ee20

Browse files
hgsgtkdiemol
andauthored
feat(java): add webdriver.edge.loglevel (#10962)
It adds a new system property `webdriver.edge.loglevel` on EdgeDriverService. It allows us to configure the log level in detail. For example, if you use version 104.0.1293.63 Microsoft Edge WebDriver, you can choose one from ALL, DEBUG, INFO, WARNING, SEVERE, or OFF. ``` $ ./msedgedriver --help --log-level=LEVEL set log level: ALL, DEBUG, INFO, WARNING, SEVERE, OFF ``` What this system property does is to make sure to specify the `--log-level` option like the others. Fixes #10961 Co-authored-by: Diego Molina <[email protected]>
1 parent 2b98f9b commit ce2ee20

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

java/src/org/openqa/selenium/edge/EdgeDriverService.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public class EdgeDriverService extends DriverService {
5050
*/
5151
public static final String EDGE_DRIVER_LOG_PROPERTY = "webdriver.edge.logfile";
5252

53+
/**
54+
* System property that defines the log level when MicrosoftWebDriver output is logged.
55+
*/
56+
public static final String EDGE_DRIVER_LOG_LEVEL_PROPERTY = "webdriver.edge.loglevel";
57+
5358
/**
5459
* Boolean system property that defines whether the MicrosoftWebDriver executable should be started
5560
* with verbose logging.
@@ -114,6 +119,7 @@ public static class Builder extends DriverService.Builder<
114119

115120
private final boolean disableBuildCheck = Boolean.getBoolean(EDGE_DRIVER_DISABLE_BUILD_CHECK);
116121
private boolean verbose = Boolean.getBoolean(EDGE_DRIVER_VERBOSE_LOG_PROPERTY);
122+
private String loglevel = System.getProperty(EDGE_DRIVER_LOG_LEVEL_PROPERTY);
117123
private boolean silent = Boolean.getBoolean(EDGE_DRIVER_SILENT_OUTPUT_PROPERTY);
118124
private String allowedListIps = System.getProperty(EDGE_DRIVER_ALLOWED_IPS_PROPERTY);
119125

@@ -148,6 +154,14 @@ public EdgeDriverService.Builder withVerbose(boolean verbose) {
148154
return this;
149155
}
150156

157+
/**
158+
* Configures the driver server log level.
159+
*/
160+
public EdgeDriverService.Builder withLoglevel(String level) {
161+
this.loglevel = level;
162+
return this;
163+
}
164+
151165
/**
152166
* Configures the driver server for silent output.
153167
*
@@ -199,6 +213,9 @@ protected List<String> createArgs() {
199213
if (silent) {
200214
args.add("--silent");
201215
}
216+
if (loglevel != null) {
217+
args.add(String.format("--log-level=%s", loglevel));
218+
}
202219
if (allowedListIps != null) {
203220
args.add(String.format("--whitelisted-ips=%s", allowedListIps));
204221
}

0 commit comments

Comments
 (0)