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

kafka appender layout does not work for kafka 0.7.1

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.7.1, 0.8.0
    • Fix Version/s: 0.8.2.0
    • Component/s: producer
    • Labels:
    • Environment:
      Win7 64 bit

      Description

      I am using kafka 0.7.1 right now.
      I am using the following log4j properties file and trying to send some log information to kafka server.

      log4j.rootLogger=INFO,file,stdout

      log4j.appender.stdout=org.apache.log4j.ConsoleAppender
      log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
      log4j.appender.stdout.layout.ConversionPattern=[%d] %p %t %m (%c)%n

      log4j.appender.file=org.apache.log4j.RollingFileAppender
      #log4j.appender.file.FileNamePattern=c:\\development
      producer-agent_%d

      {yyyy-MM-dd}

      .log
      log4j.appender.file.File=${AC_DATA_HOME}\\lmservice
      tailer-aggregator.log
      log4j.appender.file.MaxFileSize=100MB
      log4j.appender.file.MaxBackupIndex=1
      log4j.appender.file.layout=org.apache.log4j.PatternLayout
      #log4j.appender.file.layout.ConversionPattern= %-4r [%t] %-5p %c %x - %m%n
      log4j.appender.file.layout.ConversionPattern=[%d] %p %t %m (%c)%n

      log4j.appender.KAFKA=kafka.producer.KafkaLog4jAppender
      log4j.appender.KAFKA.layout=org.apache.log4j.PatternLayout
      log4j.appender.KAFKA.layout.ConversionPattern=[%d] %p %t %m (%c)%n
      log4j.appender.KAFKA.BrokerList=0:localhost:9092
      log4j.appender.KAFKA.SerializerClass=kafka.serializer.StringEncoder
      log4j.appender.KAFKA.Topic=test.topic

      1. Turn on all our debugging info
        log4j.logger.kafka=INFO, KAFKA
        log4j.logger.org=INFO, KAFKA
        log4j.logger.com=INFO, KAFKA

      However, I find that the messages send to kafka server are not formatted as my defined layout.
      KafkaLog4jAppender just sends messages(%m), and there is no other conversion patterns.

        Attachments

        1. KAFKA-847-v1.patch
          6 kB
          Peter Pham
        2. KAFKA-847-v2.patch
          0.9 kB
          Aleksandra Nowak

          Activity

            People

            • Assignee:
              peterp Peter Pham
              Reporter:
              siningma Sining Ma
              Reviewer:
              Neha Narkhede
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: