Skip to content

Commit fd21461

Browse files
committed
Remove stacktrace from recoverable discovery log warnings
This is to reduce the noise in the logs when recoverable discovery exceptions occur. Complete discovery failures are expected to be reported separately.
1 parent 10f76ea commit fd21461

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

driver/src/main/java/org/neo4j/driver/internal/cluster/RediscoveryImpl.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@
5353
import static org.neo4j.driver.internal.util.Futures.failedFuture;
5454

5555
/**
56-
* This class is used by all router tables to perform discovery.
57-
* In other words, the methods in this class could be called by multiple threads concurrently.
56+
* This class is used by all router tables to perform discovery. In other words, the methods in this class could be called by multiple threads concurrently.
5857
*/
5958
public class RediscoveryImpl implements Rediscovery
6059
{
6160
private static final String NO_ROUTERS_AVAILABLE = "Could not perform discovery for database '%s'. No routing server available.";
6261
private static final String RECOVERABLE_ROUTING_ERROR = "Failed to update routing table with server '%s'.";
62+
private static final String RECOVERABLE_DISCOVERY_ERROR_WITH_SERVER = "Received a recoverable discovery error with server '%s', " +
63+
"will continue discovery with other routing servers if available. " +
64+
"Complete routing failures will be reported separately from this warning.";
6365

6466
private final BoltServerAddress initialRouter;
6567
private final RoutingSettings settings;
@@ -291,8 +293,9 @@ private ClusterComposition handleRoutingProcedureError( Throwable error, Routing
291293
// Retriable error happened during discovery.
292294
DiscoveryException discoveryError = new DiscoveryException( format( RECOVERABLE_ROUTING_ERROR, routerAddress ), error );
293295
Futures.combineErrors( baseError, discoveryError ); // we record each failure here
294-
logger.warn( format( "Received a recoverable discovery error with server '%s', will continue discovery with other routing servers if available.",
295-
routerAddress ), discoveryError );
296+
String warningMessage = format( RECOVERABLE_DISCOVERY_ERROR_WITH_SERVER, routerAddress );
297+
logger.warn( warningMessage );
298+
logger.debug( warningMessage, discoveryError );
296299
routingTable.forget( routerAddress );
297300
return null;
298301
}

0 commit comments

Comments
 (0)