Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13842

Improve Logging on KafkaConsumer when KafkaException is Thrown

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: camel-kafka
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      The Kafka Camel component "hides" the stacktrace of exceptions occurring in the following point. 

      components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
      ...
      log.warn("KafkaException consuming {} from topic {}. Will attempt to re-connect on next run", threadId, topicName);
      reConnect = true;
      ...

      It makes difficult to know the root of the KafkaException exception (NullPointer for example) by seeing the log.

      Maybe change the log.warn to handtleException so we can see the full stack trace in the log, since LoggingExceptionHandler logs the full stack trace.

      ...
      getExceptionHandler().handleException("KafkaException consuming " + threadId + " from topic " + topicName + ". Will attempt to re-connect on next run", e);
      reConnect = true;
      ...

       

        Attachments

          Activity

            People

            • Assignee:
              ramu11 Ramu
              Reporter:
              LeonardoZV Leonardo Vasconcellos
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: