|
35 | 35 | import java.lang.reflect.Proxy; |
36 | 36 | import java.util.Arrays; |
37 | 37 | import java.util.Collections; |
| 38 | +import java.util.HashSet; |
38 | 39 | import java.util.Map; |
39 | 40 |
|
40 | 41 | /** |
@@ -312,6 +313,8 @@ public String toString() { |
312 | 313 |
|
313 | 314 | private volatile boolean hasSuccessfulCall = false; |
314 | 315 |
|
| 316 | + private HashSet<String> failedAtLeastOnce = new HashSet<>(); |
| 317 | + |
315 | 318 | private final RetryPolicy defaultPolicy; |
316 | 319 | private final Map<String,RetryPolicy> methodNameToPolicyMap; |
317 | 320 |
|
@@ -390,12 +393,18 @@ private RetryInfo handleException(final Method method, final int callId, |
390 | 393 |
|
391 | 394 | private void log(final Method method, final boolean isFailover, |
392 | 395 | final int failovers, final long delay, final Exception ex) { |
393 | | - // log info if this has made some successful calls or |
394 | | - // this is not the first failover |
395 | | - final boolean info = hasSuccessfulCall || failovers != 0 |
396 | | - || asyncCallHandler.hasSuccessfulCall(); |
397 | | - if (!info && !LOG.isDebugEnabled()) { |
398 | | - return; |
| 396 | + boolean info = true; |
| 397 | + // If this is the first failover to this proxy, skip logging at INFO level |
| 398 | + if (!failedAtLeastOnce.contains(proxyDescriptor.getProxyInfo().toString())) |
| 399 | + { |
| 400 | + failedAtLeastOnce.add(proxyDescriptor.getProxyInfo().toString()); |
| 401 | + |
| 402 | + // If successful calls were made to this proxy, log info even for first |
| 403 | + // failover |
| 404 | + info = hasSuccessfulCall || asyncCallHandler.hasSuccessfulCall(); |
| 405 | + if (!info && !LOG.isDebugEnabled()) { |
| 406 | + return; |
| 407 | + } |
399 | 408 | } |
400 | 409 |
|
401 | 410 | final StringBuilder b = new StringBuilder() |
|
0 commit comments