kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: KAFKA-4806; Prevent double logging of ConsumerConfig
Date Mon, 27 Feb 2017 11:49:57 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.2 8488b81a5 -> 35684acad


KAFKA-4806; Prevent double logging of ConsumerConfig

The consumer properties get logged twice since two instances
of ConsumerConfig are created during creation of KafkaConsumer.

I added a constructor of ConsumerConfig accepting the boolean
parameter doLog which is already passable in AbstractConfig
and set it to false during the second ConsumerConfig creating
in the KafkaConsumer constructor.

Author: Marco Ebert <marco_ebert@icloud.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #2600 from Gacko/trunk

(cherry picked from commit 9260e8563c19cc1c5ac2d47ad05955774138036d)
Signed-off-by: Ismael Juma <ismael@juma.me.uk>


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/35684aca
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/35684aca
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/35684aca

Branch: refs/heads/0.10.2
Commit: 35684acad2df18c8f39c2f72a596714263b64f64
Parents: 8488b81
Author: Marco Ebert <marco_ebert@icloud.com>
Authored: Mon Feb 27 11:48:50 2017 +0000
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Mon Feb 27 11:49:59 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/kafka/clients/consumer/ConsumerConfig.java   | 4 ++++
 .../java/org/apache/kafka/clients/consumer/KafkaConsumer.java    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/35684aca/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java b/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java
index ed809a9..1b33517 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java
@@ -426,6 +426,10 @@ public class ConsumerConfig extends AbstractConfig {
         super(CONFIG, props);
     }
 
+    ConsumerConfig(Map<?, ?> props, boolean doLog) {
+        super(CONFIG, props, doLog);
+    }
+
     public static Set<String> configNames() {
         return CONFIG.names();
     }

http://git-wip-us.apache.org/repos/asf/kafka/blob/35684aca/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
index 2791bc5..eac9579 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
@@ -630,7 +630,7 @@ public class KafkaConsumer<K, V> implements Consumer<K, V>
{
             // load interceptors and make sure they get clientId
             Map<String, Object> userProvidedConfigs = config.originals();
             userProvidedConfigs.put(ConsumerConfig.CLIENT_ID_CONFIG, clientId);
-            List<ConsumerInterceptor<K, V>> interceptorList = (List) (new ConsumerConfig(userProvidedConfigs)).getConfiguredInstances(ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG,
+            List<ConsumerInterceptor<K, V>> interceptorList = (List) (new ConsumerConfig(userProvidedConfigs,
false)).getConfiguredInstances(ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG,
                     ConsumerInterceptor.class);
             this.interceptors = interceptorList.isEmpty() ? null : new ConsumerInterceptors<>(interceptorList);
             if (keyDeserializer == null) {


Mime
View raw message