@@ -46,6 +46,11 @@ public class ChromeDriverService extends DriverService {
46
46
*/
47
47
public static final String CHROME_DRIVER_EXE_PROPERTY = "webdriver.chrome.driver" ;
48
48
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
+
49
54
/**
50
55
* System property that defines the default location where ChromeDriver output is logged.
51
56
*/
@@ -155,6 +160,7 @@ public static class Builder extends DriverService.Builder<
155
160
ChromeDriverService , ChromeDriverService .Builder > {
156
161
157
162
private boolean disableBuildCheck = Boolean .getBoolean (CHROME_DRIVER_DISABLE_BUILD_CHECK );
163
+ private boolean readableTimestamp = Boolean .getBoolean (CHROME_DRIVER_READABLE_TIMESTAMP );
158
164
private boolean appendLog = Boolean .getBoolean (CHROME_DRIVER_APPEND_LOG_PROPERTY );
159
165
private boolean verbose = Boolean .getBoolean (CHROME_DRIVER_VERBOSE_LOG_PROPERTY );
160
166
private boolean silent = Boolean .getBoolean (CHROME_DRIVER_SILENT_OUTPUT_PROPERTY );
@@ -252,6 +258,17 @@ public Builder withWhitelistedIps(String whitelistedIps) {
252
258
return this ;
253
259
}
254
260
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
+
255
272
@ Override
256
273
protected File findDefaultExecutable () {
257
274
return findExecutable (
@@ -282,6 +299,10 @@ protected List<String> createArgs() {
282
299
args .add (String .format ("--port=%d" , getPort ()));
283
300
if (getLogFile () != null ) {
284
301
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
+ }
285
306
}
286
307
if (appendLog ) {
287
308
args .add ("--append-log" );
0 commit comments