From bae3ddd4ea30f95b1467567c5df8edd84d0905fe Mon Sep 17 00:00:00 2001 From: Olga MaciaszekSharma Date: Mon, 12 Jul 2021 20:02:18 +0200 Subject: [PATCH] Handle errror logging not enabled. --- .../core/DiscoveryClientServiceInstanceListSupplier.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/DiscoveryClientServiceInstanceListSupplier.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/DiscoveryClientServiceInstanceListSupplier.java index 460195e7..e1f33998 100644 --- a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/DiscoveryClientServiceInstanceListSupplier.java +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/DiscoveryClientServiceInstanceListSupplier.java @@ -109,7 +109,9 @@ public class DiscoveryClientServiceInstanceListSupplier implements ServiceInstan } private void logException(Throwable error) { - LOG.error(String.format("Exception occurred while retrieving instances for service %s", serviceId), error); + if (LOG.isErrorEnabled()) { + LOG.error(String.format("Exception occurred while retrieving instances for service %s", serviceId), error); + } } }