kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject kafka git commit: MINOR: Only include transactional id in LogContext if it's set
Date Tue, 19 Sep 2017 23:07:20 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 92c06cbad -> 80e0af50d


MINOR: Only include transactional id in LogContext if it's set

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

Reviewers: Apurva Mehta <apurva@confluent.io>, Jason Gustafson <jason@confluent.io>

Closes #3910 from ijuma/transactional-id-should-be-optional-in-log-context


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

Branch: refs/heads/trunk
Commit: 80e0af50d94ffb99f669e55581d262db5f6dd027
Parents: 92c06cb
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Tue Sep 19 16:01:15 2017 -0700
Committer: Jason Gustafson <jason@confluent.io>
Committed: Tue Sep 19 16:01:15 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/kafka/clients/producer/KafkaProducer.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/80e0af50/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
index b630d61..7d51640 100644
--- a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
+++ b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
@@ -316,7 +316,11 @@ public class KafkaProducer<K, V> implements Producer<K, V>
{
 
             String transactionalId = userProvidedConfigs.containsKey(ProducerConfig.TRANSACTIONAL_ID_CONFIG)
?
                     (String) userProvidedConfigs.get(ProducerConfig.TRANSACTIONAL_ID_CONFIG)
: null;
-            LogContext logContext = new LogContext(String.format("[Producer clientId=%s,
transactionalId=%s] ", clientId, transactionalId));
+            LogContext logContext;
+            if (transactionalId == null)
+                logContext = new LogContext(String.format("[Producer clientId=%s] ", clientId));
+            else
+                logContext = new LogContext(String.format("[Producer clientId=%s, transactionalId=%s]
", clientId, transactionalId));
             log = logContext.logger(KafkaProducer.class);
             log.trace("Starting the Kafka producer");
 


Mime
View raw message