Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-4710

Logging trait breaking logging location information retrival by log4j

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.10.0.1
    • Fix Version/s: None
    • Component/s: core
    • Labels:

      Description

      We have in-house logging systems which sends problematic logs such as WARNs and ERRORs to the counting system.
      The log4j appender is provided to send logs to the system. However, currently the most of logs written by Kafka broker are actually pointing the line of Logging trait since the most of them are written through calling Logging trait's helper method.

      This happens when we add some modifiers such as %l to log4j appender pattern as well:

      diff --git a/config/log4j.properties b/config/log4j.properties
      index bf816e76d..e1b69e0da 100644
      --- a/config/log4j.properties
      +++ b/config/log4j.properties
      @@ -23,7 +23,7 @@ log4j.appender.kafkaAppender=org.apache.log4j.DailyRollingFileAppender
       log4j.appender.kafkaAppender.DatePattern='.'yyyy-MM-dd-HH
       log4j.appender.kafkaAppender.File=${kafka.logs.dir}/server.log
       log4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout
      -log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
      +log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c) - %l%n
      
      [2017-01-30 15:48:28,333] INFO starting (kafka.server.KafkaServer) - kafka.utils.Logging$class.info(Logging.scala:68)
      [2017-01-30 15:48:28,339] INFO Connecting to zookeeper on localhost:2181 (kafka.server.KafkaServer) - kafka.utils.Logging$class.info(Logging.scala:68)
      [2017-01-30 15:48:34,908] FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) - kafka.utils.Logging$class.fatal(Logging.scala:116)
      

      As you can see, all locations are pointing somewhere of Logging.scala rather than the actual locations where logs are written.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kawamuray Yuto Kawamura
                Reporter:
                kawamuray Yuto Kawamura
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: