You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/08/10 16:26:41 UTC

[camel] 03/06: (chores) camel-kafka: add log guard on resume strategy critical path

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8bf4ae698469a4d4a4010410a4eb8d382becc07c
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Aug 8 16:16:37 2022 +0200

    (chores) camel-kafka: add log guard on resume strategy critical path
---
 .../processor/resume/kafka/SingleNodeKafkaResumeStrategy.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java b/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java
index 007e9d29bb7..b731e9b0c1c 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/processor/resume/kafka/SingleNodeKafkaResumeStrategy.java
@@ -130,7 +130,9 @@ public class SingleNodeKafkaResumeStrategy<T extends Resumable> implements Kafka
         OffsetKey<?> key = offset.getOffsetKey();
         Offset<?> offsetValue = offset.getLastOffset();
 
-        LOG.debug("Updating offset on Kafka with key {} to {}", key.getValue(), offsetValue.getValue());
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Updating offset on Kafka with key {} to {}", key.getValue(), offsetValue.getValue());
+        }
 
         ByteBuffer keyBuffer = key.serialize();
         ByteBuffer valueBuffer = offsetValue.serialize();
@@ -173,7 +175,9 @@ public class SingleNodeKafkaResumeStrategy<T extends Resumable> implements Kafka
             for (ConsumerRecord<byte[], byte[]> record : records) {
                 byte[] value = record.value();
 
-                LOG.trace("Read from Kafka: {}", value);
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Read from Kafka: {}", value);
+                }
 
                 if (!deserializable.deserialize(ByteBuffer.wrap(record.key()), ByteBuffer.wrap(record.value()))) {
                     LOG.warn("Deserializer indicates that this is the last record to deserialize");