Browse Source

Merge pull request #266 from Shopify/better-loggin

Log more things
Evan Huus 10 years ago
parent
commit
afe4e78f8b
2 changed files with 5 additions and 1 deletions
  1. 1 1
      client.go
  2. 4 0
      producer.go

+ 1 - 1
client.go

@@ -350,7 +350,7 @@ func (client *Client) refreshMetadata(topics []string, retriesRemaining int) err
 	}
 
 	for broker := client.any(); broker != nil; broker = client.any() {
-		Logger.Printf("Fetching metadata from broker %s\n", broker.addr)
+		Logger.Printf("Fetching metadata for %v from broker %s\n", topics, broker.addr)
 		response, err := broker.GetMetadata(client.id, &MetadataRequest{Topics: topics})
 
 		switch err {

+ 4 - 0
producer.go

@@ -395,6 +395,7 @@ func (p *Producer) leaderDispatcher(topic string, partition int32, input chan *M
 				// on the very first retried message we send off a chaser so that we know when everything "in between" has made it
 				// back to us and we can safely flush the backlog (otherwise we risk re-ordering messages)
 				Logger.Printf("producer/leader state change to [retrying] on %s/%d\n", topic, partition)
+				Logger.Printf("producer/leader abandoning broker %d on %s/%d\n", leader.ID(), topic, partition)
 				output <- &MessageToSend{Topic: topic, partition: partition, flags: chaser}
 				backlog = make([]*MessageToSend, 0)
 				p.unrefBrokerWorker(leader)
@@ -411,6 +412,7 @@ func (p *Producer) leaderDispatcher(topic string, partition int32, input chan *M
 					backlog = nil
 					continue
 				}
+				Logger.Printf("producer/leader selected broker %d on %s/%d\n", leader.ID(), topic, partition)
 			}
 
 			for _, msg := range backlog {
@@ -427,6 +429,7 @@ func (p *Producer) leaderDispatcher(topic string, partition int32, input chan *M
 				p.returnError(msg, err)
 				continue
 			}
+			Logger.Printf("producer/leader selected broker %d on %s/%d\n", leader.ID(), topic, partition)
 		}
 
 		output <- msg
@@ -502,6 +505,7 @@ shutdown:
 func (p *Producer) flusher(broker *Broker, input chan []*MessageToSend) {
 	var closing error
 	currentRetries := make(map[string]map[int32]error)
+	Logger.Printf("producer/flusher/%d starting up\n", broker.ID())
 
 	for batch := range input {
 		if closing != nil {