From 300b94879dfdda892a0fffc532580068a585f771 Mon Sep 17 00:00:00 2001 From: Willem van Bergen Date: Thu, 9 Apr 2015 05:58:32 -0400 Subject: [PATCH] Improve logging --- client.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index a135b0fc5..2ea5f3b8a 100644 --- a/client.go +++ b/client.go @@ -327,8 +327,6 @@ func (client *client) Coordinator(consumerGroup string) (*Broker, error) { return nil, err } - Logger.Printf("client/coordinator Caching #%d (%s) as coordinator for consumergoup %s.\n", coordinator.ID(), coordinator.Addr(), consumerGroup) - client.coordinatorLock.Lock() client.coordinators[consumerGroup] = coordinator client.coordinatorLock.Unlock() @@ -631,7 +629,7 @@ func (client *client) updateMetadata(data *MetadataResponse) ([]string, error) { func (client *client) refreshCoordinator(consumerGroup string, attemptsRemaining int) (*Broker, error) { for broker := client.any(); broker != nil; broker = client.any() { - Logger.Printf("client/coordinator Finding coordinator for consumergoup %s fom %s.\n", consumerGroup, broker.Addr()) + Logger.Printf("client/coordinator Requesting coordinator for consumergoup %s from %s.\n", consumerGroup, broker.Addr()) request := new(ConsumerMetadataRequest) request.ConsumerGroup = consumerGroup @@ -639,6 +637,7 @@ func (client *client) refreshCoordinator(consumerGroup string, attemptsRemaining response, err := broker.GetConsumerMetadata(request) if err != nil { + Logger.Printf("client/coordinator Request to broker %s failed: %s.\n", broker.Addr(), err) _ = broker.Close() client.disconnectBroker(broker) continue @@ -666,7 +665,7 @@ func (client *client) refreshCoordinator(consumerGroup string, attemptsRemaining return coordinator, nil case ErrConsumerCoordinatorNotAvailable: - Logger.Printf("client/coordinator Coordinator for consumer group %s not yet available, trying again in 1s...\n", consumerGroup, attemptsRemaining) + Logger.Printf("client/coordinator Coordinator for consumer group %s not yet available, trying again in %dms...\n", consumerGroup, client.conf.Metadata.Retry.Backoff/time.Millisecond) time.Sleep(client.conf.Metadata.Retry.Backoff) continue