You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jg...@apache.org on 2017/09/19 23:07:20 UTC
kafka git commit: MINOR: Only include transactional id in LogContext
if it's set
Repository: kafka
Updated Branches:
refs/heads/trunk 92c06cbad -> 80e0af50d
MINOR: Only include transactional id in LogContext if it's set
Author: Ismael Juma <is...@juma.me.uk>
Reviewers: Apurva Mehta <ap...@confluent.io>, Jason Gustafson <ja...@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 <is...@juma.me.uk>
Authored: Tue Sep 19 16:01:15 2017 -0700
Committer: Jason Gustafson <ja...@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");