SebTardif opened a new pull request, #4125:
URL: https://github.com/apache/logging-log4j2/pull/4125

   Fix KafkaAppender retry logic that always reports an error to the error 
handler even when a retry succeeds.
   
   When `retryCount` is configured and the initial `tryAppend()` fails, the 
retry loop uses `break` to exit on success. However, `break` only exits the 
`while` loop; execution always reaches the `error()` call afterward. This 
causes spurious error notifications for transient Kafka failures that were 
successfully recovered by a retry.
   
   This change replaces `break` with `return` so that a successful retry exits 
`append()` without reporting an error. Retry exceptions are now logged at DEBUG 
level for diagnostics instead of being silently discarded.
   
   Also removes dead code in `Builder.getRetryCount()` where 
`Integer.valueOf(int)` was wrapped in a `NumberFormatException` catch that can 
never fire.
   
   The bug was introduced in #315.
   
   ## Checklist
   
   * Base your changes on `2.x` branch if you are targeting Log4j 2; use `main` 
otherwise
   * `./mvnw verify` succeeds ([the build 
instructions](https://logging.apache.org/log4j/2.x/development.html#building))
   * Tests are provided


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to