Skip to content

Commit

Permalink
Log EOF errors to standard logger (segmentio#294)
Browse files Browse the repository at this point in the history
They were being logged to the error logger, which caused error-level
logs to be written frequently when topics had no messages to consume.
  • Loading branch information
dylannz-sailthru authored and Achille committed Sep 16, 2019
1 parent 0430ada commit 602d499
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,14 @@ func (r *reader) run(ctx context.Context, offset int64) {
r.sendError(ctx, err)
break readLoop

case io.EOF:
r.withLogger(func(log *log.Logger) {
log.Printf("the kafka reader got an EOF for partition %d of %s at offset %d: %s", r.partition, r.topic, offset, err)
})
r.stats.errors.observe(1)
conn.Close()
break readLoop

default:
if _, ok := err.(Error); ok {
r.sendError(ctx, err)
Expand Down

0 comments on commit 602d499

Please sign in to comment.