@@ -46,6 +46,11 @@ public class ChromeDriverService extends DriverService {
4646 */
4747 public static final String CHROME_DRIVER_EXE_PROPERTY = "webdriver.chrome.driver" ;
4848
49+ /**
50+ * System property that toggles the formatting of the timestamps of the logs
51+ */
52+ public static final String CHROME_DRIVER_READABLE_TIMESTAMP = "webdriver.chrome.readableTimestamp" ;
53+
4954 /**
5055 * System property that defines the default location where ChromeDriver output is logged.
5156 */
@@ -155,6 +160,7 @@ public static class Builder extends DriverService.Builder<
155160 ChromeDriverService , ChromeDriverService .Builder > {
156161
157162 private boolean disableBuildCheck = Boolean .getBoolean (CHROME_DRIVER_DISABLE_BUILD_CHECK );
163+ private boolean readableTimestamp = Boolean .getBoolean (CHROME_DRIVER_READABLE_TIMESTAMP );
158164 private boolean appendLog = Boolean .getBoolean (CHROME_DRIVER_APPEND_LOG_PROPERTY );
159165 private boolean verbose = Boolean .getBoolean (CHROME_DRIVER_VERBOSE_LOG_PROPERTY );
160166 private boolean silent = Boolean .getBoolean (CHROME_DRIVER_SILENT_OUTPUT_PROPERTY );
@@ -252,6 +258,17 @@ public Builder withWhitelistedIps(String whitelistedIps) {
252258 return this ;
253259 }
254260
261+ /**
262+ * Configures the format of the logging for the driver server.
263+ *
264+ * @param readableTimestamp Whether the timestamp of the log is readable.
265+ * @return A self reference.
266+ */
267+ public Builder withReadableTimestamp (Boolean readableTimestamp ) {
268+ this .readableTimestamp = readableTimestamp ;
269+ return this ;
270+ }
271+
255272 @ Override
256273 protected File findDefaultExecutable () {
257274 return findExecutable (
@@ -282,6 +299,10 @@ protected List<String> createArgs() {
282299 args .add (String .format ("--port=%d" , getPort ()));
283300 if (getLogFile () != null ) {
284301 args .add (String .format ("--log-path=%s" , getLogFile ().getAbsolutePath ()));
302+ // This flag only works when logged to file
303+ if (readableTimestamp ) {
304+ args .add ("--readable-timestamp" );
305+ }
285306 }
286307 if (appendLog ) {
287308 args .add ("--append-log" );
0 commit comments