kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbej...@apache.org
Subject [kafka] branch trunk updated: MINOR: Move log statement stating producer closed after possible exception (#6606)
Date Mon, 22 Apr 2019 22:59:12 GMT
This is an automated email from the ASF dual-hosted git repository.

bbejeck pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a552a27  MINOR: Move log statement stating producer closed after possible exception
(#6606)
a552a27 is described below

commit a552a2704e36b6db0a6295370d4e190ff212d5d1
Author: Bill Bejeck <bbejeck@gmail.com>
AuthorDate: Mon Apr 22 18:59:00 2019 -0400

    MINOR: Move log statement stating producer closed after possible exception (#6606)
    
    In the KafkaProducer#close method we have a debug log statement Kafka producer has been
closed then a few lines later a KafkaException can occur.
    This could be confusing to users, so this PR simply moves the log statement to after the
possible exception to avoid confusing information in the logs.
    
    Reviewers:  Guozhang Wang <wangguoz@gmail.com>
---
 .../src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 e9d2626..83a4d51 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
@@ -1189,7 +1189,6 @@ public class KafkaProducer<K, V> implements Producer<K, V>
{
         ClientUtils.closeQuietly(valueSerializer, "producer valueSerializer", firstException);
         ClientUtils.closeQuietly(partitioner, "producer partitioner", firstException);
         AppInfoParser.unregisterAppInfo(JMX_PREFIX, clientId, metrics);
-        log.debug("Kafka producer has been closed");
         Throwable exception = firstException.get();
         if (exception != null && !swallowException) {
             if (exception instanceof InterruptException) {
@@ -1197,6 +1196,7 @@ public class KafkaProducer<K, V> implements Producer<K, V>
{
             }
             throw new KafkaException("Failed to close kafka producer", exception);
         }
+        log.debug("Kafka producer has been closed");
     }
 
     private static Map<String, Object> propsToMap(Properties properties) {


Mime
View raw message