Skip to content

Commit 2f93dee

Browse files
committed
[java] Only logging these retries in debug mode.
When leaving them in warning, it does pollute the logs a bit too much. Skipping ci since this is only a logging change. [skip ci]
1 parent c939d16 commit 2f93dee

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

java/src/org/openqa/selenium/remote/http/RetryRequest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,21 @@
1717

1818
package org.openqa.selenium.remote.http;
1919

20+
import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
21+
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
22+
import static java.net.HttpURLConnection.HTTP_UNAVAILABLE;
23+
import static org.openqa.selenium.internal.Debug.getDebugLogLevel;
24+
2025
import net.jodah.failsafe.Failsafe;
2126
import net.jodah.failsafe.RetryPolicy;
27+
2228
import org.openqa.selenium.TimeoutException;
2329

2430
import java.net.ConnectException;
2531
import java.time.Duration;
2632
import java.time.temporal.ChronoUnit;
27-
import java.util.logging.Level;
2833
import java.util.logging.Logger;
2934

30-
import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
31-
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
32-
import static java.net.HttpURLConnection.HTTP_UNAVAILABLE;
33-
3435
public class RetryRequest implements Filter {
3536

3637
private static final Logger LOG = Logger.getLogger(RetryRequest.class.getName());
@@ -43,7 +44,7 @@ public class RetryRequest implements Filter {
4344
.withMaxRetries(3)
4445
.withMaxDuration(Duration.ofSeconds(10))
4546
.onRetry(e -> LOG.log(
46-
Level.WARNING,
47+
getDebugLogLevel(),
4748
"Connection failure #{0}. Retrying.",
4849
e.getAttemptCount()));
4950

@@ -55,7 +56,7 @@ public class RetryRequest implements Filter {
5556
.withMaxRetries(3)
5657
.withMaxDuration(Duration.ofSeconds(10))
5758
.onRetry(e -> LOG.log(
58-
Level.WARNING,
59+
getDebugLogLevel(),
5960
"Read timeout #{0}. Retrying.",
6061
e.getAttemptCount()));
6162

@@ -69,7 +70,7 @@ public class RetryRequest implements Filter {
6970
.withMaxRetries(2)
7071
.withMaxDuration(Duration.ofSeconds(3))
7172
.onRetry(e -> LOG.log(
72-
Level.WARNING,
73+
getDebugLogLevel(),
7374
"Failure due to server error #{0}. Retrying.",
7475
e.getAttemptCount()));
7576

0 commit comments

Comments
 (0)