From bbac0860e1cb408b86a6d1dbf25b6b2092de39bf Mon Sep 17 00:00:00 2001 From: meme-lord Date: Thu, 13 Jun 2019 13:56:00 +0100 Subject: [PATCH] GEODE-6810: Removed Superfluous Log Message The log message is the same as the log message a few lines down which results in extra spam in the logs. Improved other logs in the same file (replaces calls to String.format(), unnecessary checks etc.) --- .../internal/AutoConnectionSourceImpl.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java index 35e17075d1c4..08becbfcbeb5 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java +++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java @@ -216,8 +216,7 @@ ServerLocationResponse queryOneLocatorUsingConnection(HostAddress locator, updateLocatorInLocatorList(locator); return null; } catch (ClassNotFoundException e) { - logger.warn(String.format("Received exception from locator %s", locator), - e); + logger.warn("Received exception from locator {}", locator, e); return null; } catch (ClassCastException e) { if (logger.isDebugEnabled()) { @@ -245,15 +244,13 @@ protected void updateLocatorInLocatorList(HostAddress locator) { locator.getSocketInetAddressNoLookup().getPort()); HostAddress hostAddress = new HostAddress(changeLoc, locator.getHostName()); newLocatorsList.add(hostAddress); - logger.info("updateLocatorInLocatorList changing locator list: loc form: " + locator - + " ,loc to: " + changeLoc); } else { newLocatorsList.add(tloc); } } - logger.info("updateLocatorInLocatorList locator list from:" + locatorList.getLocators() - + " to: " + newLocatorsList); + logger.info("updateLocatorInLocatorList locator list from: {} to {}", + locatorList.getLocators(), newLocatorsList); LocatorList newLocatorList = new LocatorList(newLocatorsList); locators.set(newLocatorList); @@ -319,8 +316,7 @@ private void updateLocatorList(LocatorListResponse response) { addedLocators.removeAll(oldLocators.getLocators()); if (!addedLocators.isEmpty()) { locatorCallback.locatorsDiscovered(Collections.unmodifiableList(addedLocators)); - logger.info("AutoConnectionSource discovered new locators {}", - addedLocators); + logger.info("AutoConnectionSource discovered new locators {}", addedLocators); } if (!removedLocators.isEmpty()) { locatorCallback.locatorsRemoved(Collections.unmodifiableList(removedLocators)); @@ -381,8 +377,7 @@ public void setLocatorDiscoveryCallback(LocatorDiscoveryCallback callback) { private synchronized void reportLiveLocator(InetSocketAddress l) { Object prevState = this.locatorState.put(l, null); if (prevState != null) { - logger.info("Communication has been restored with locator {}.", - l); + logger.info("Communication has been restored with locator {}.", l); } } @@ -390,9 +385,9 @@ private synchronized void reportDeadLocator(InetSocketAddress l, Exception ex) { Object prevState = this.locatorState.put(l, ex); if (prevState == null) { if (ex instanceof ConnectException) { - logger.info(String.format("locator %s is not running.", l), ex); + logger.info("locator {} is not running.", l, ex); } else { - logger.info(String.format("Communication with locator %s failed with %s.", l, ex), ex); + logger.info("Communication with locator {} failed", l, ex); } } }