Skip to content

Commit e5d2334

Browse files
garyrussellartembilan
authored andcommitted
GH-2184: Don't Log KafkaBackoffException
Resolves #2184 `KafkaBackOffException`s are incorrectly logged at ERROR level during retries when using the no-seek error handling mode. They are not logged in the seek mode; see 448871a **cherry-pick to 2.9.x**
1 parent f1253d4 commit e5d2334

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/DefaultErrorHandler.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ public boolean handleOne(Exception thrownException, ConsumerRecord<?, ?> record,
157157
return getFailureTracker().recovered(record, thrownException, container, consumer);
158158
}
159159
catch (Exception ex) {
160-
logger.error(ex, "Failed to handle " + KafkaUtils.format(record) + " with " + thrownException);
160+
if (SeekUtils.isBackoffException(thrownException)) {
161+
this.logger.debug(ex, "Failed to handle " + KafkaUtils.format(record) + " with " + thrownException);
162+
}
163+
else {
164+
this.logger.error(ex, "Failed to handle " + KafkaUtils.format(record) + " with " + thrownException);
165+
}
161166
return false;
162167
}
163168
}

0 commit comments

Comments
 (0)