From d275cac1a32ebbe8b7a7874e24b5a0404f61396b Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Sat, 26 Mar 2016 22:41:08 -0700 Subject: [PATCH] Logging improvements Comment out noisly loggers for the time being. Improve the final logging statement to be useful and hint what the next active server for the client is going to be. --- consul/server_manager/server_manager.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/consul/server_manager/server_manager.go b/consul/server_manager/server_manager.go index 9d3cbe23e2..eab5ebbd46 100644 --- a/consul/server_manager/server_manager.go +++ b/consul/server_manager/server_manager.go @@ -286,6 +286,7 @@ FAILED_SERVER_DURING_REBALANCE: // Early abort if there is no value to shuffling if len(serverCfg.servers) < 2 { + // sm.logger.Printf("[INFO] server manager: can't rebalance with only %d servers", len(serverCfg.servers)) return } @@ -300,7 +301,7 @@ FAILED_SERVER_DURING_REBALANCE: // while Serf detects the node has failed. selectedServer := serverCfg.servers[0] - sm.logger.Printf("[INFO] server manager: Preemptively testing server %s before rebalance", selectedServer.String()) + // sm.logger.Printf("[INFO] server manager: Preemptively testing server %s before rebalance", selectedServer.String()) ok := sm.connPoolPinger.PingConsulServer(selectedServer) if ok { foundHealthyServer = true @@ -313,7 +314,7 @@ FAILED_SERVER_DURING_REBALANCE: // the world a happy place again. if !foundHealthyServer { const backoffDuration = 1 * time.Second - sm.logger.Printf("[INFO] server manager: No servers available, sleeping for %v", backoffDuration) + // sm.logger.Printf("[INFO] server manager: No servers available, sleeping for %v", backoffDuration) // Sleep with no locks time.Sleep(backoffDuration) @@ -379,7 +380,7 @@ FAILED_SERVER_DURING_REBALANCE: goto FAILED_SERVER_DURING_REBALANCE } - sm.logger.Printf("[INFO] server manager: Rebalancing server connections complete") + sm.logger.Printf("[INFO] server manager: Rebalanced %d servers, next active server is %s", len(serverCfg.servers), serverCfg.servers[0].String()) return }