orpiske commented on code in PR #7392:
URL: https://github.com/apache/camel/pull/7392#discussion_r847023719
##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/resume/ResumableCompletion.java:
##########
@@ -70,6 +73,29 @@ public void onComplete(Exchange exchange) {
@Override
public void onFailure(Exchange exchange) {
- LOG.warn("Skipping offset update for due to failure in processing");
+ Exception e = exchange.getException();
+ Object offset = exchange.getMessage().getHeader(Exchange.OFFSET);
+
+ if (offset instanceof Resumable) {
+ Resumable<?, ?> resumable = (Resumable<?, ?>) offset;
+
+ if (loggingLevel == LoggingLevel.DEBUG && LOG.isDebugEnabled()) {
Review Comment:
Thanks!
So, what I want here is for the logger to log the exception only if the API
log level is debug or lower. Because, then, it makes it easier to figure out
what caused the update to not happen.
Do I understand correctly that you are suggesting me to do something like
the code below?
```
if (LOG.isDebugEnabled()) {
CamelLogger.log(LOG, "Skipping offset update with address '{}' and
offset value '{}' due to failure in processing: {}",
resumable.getAddressable(),
resumable.getLastOffset().offset(), e.getMessage(), e);
} else {
CamelLogger.log(LOG, "Skipping offset update with address '{}' and
offset value '{}' due to failure in processing: {}",
resumable.getAddressable(),
resumable.getLastOffset().offset(), e.getMessage());
}
```
--
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]