Skip to content

Commit

Permalink
[java] add support for appendLog to msedgedriver service
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Dec 10, 2022
1 parent 58ce7e5 commit e54fedb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions java/src/org/openqa/selenium/edge/EdgeDriverService.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public class EdgeDriverService extends DriverService {
*/
public static final String EDGE_DRIVER_LOG_LEVEL_PROPERTY = "webdriver.edge.loglevel";

/**
* Boolean system property that defines whether MSEdgeDriver should append to existing log file.
*/
public static final String EDGE_DRIVER_APPEND_LOG_PROPERTY = "webdriver.edge.appendLog";

/**
* Boolean system property that defines whether the MicrosoftWebDriver executable should be started
* with verbose logging.
Expand Down Expand Up @@ -118,6 +123,7 @@ public static class Builder extends DriverService.Builder<
EdgeDriverService, EdgeDriverService.Builder> {

private final boolean disableBuildCheck = Boolean.getBoolean(EDGE_DRIVER_DISABLE_BUILD_CHECK);
private boolean appendLog = Boolean.getBoolean(EDGE_DRIVER_APPEND_LOG_PROPERTY);
private boolean verbose = Boolean.getBoolean(EDGE_DRIVER_VERBOSE_LOG_PROPERTY);
private String logLevel = System.getProperty(EDGE_DRIVER_LOG_LEVEL_PROPERTY);
private boolean silent = Boolean.getBoolean(EDGE_DRIVER_SILENT_OUTPUT_PROPERTY);
Expand All @@ -143,6 +149,17 @@ public int score(Capabilities capabilities) {
return score;
}

/**
* Configures the driver server appending to log file.
*
* @param appendLog True for appending to log file, false otherwise.
* @return A self reference.
*/
public EdgeDriverService.Builder withAppendLog(boolean appendLog) {
this.appendLog = appendLog;
return this;
}

/**
* Configures the driver server verbosity.
*
Expand Down Expand Up @@ -223,6 +240,9 @@ protected List<String> createArgs() {
if (getLogFile() != null) {
args.add(String.format("--log-path=%s", getLogFile().getAbsolutePath()));
}
if (appendLog) {
args.add("--append-log");
}
if (logLevel != null) {
args.add(String.format("--log-level=%s", logLevel));
}
Expand Down

0 comments on commit e54fedb

Please sign in to comment.