log4j не может написать лог в кафку потребителя - PullRequest
1 голос
/ 23 марта 2020

Мне нужно писать логи в кафке, но я получаю эту ошибку:

2020-03-22 22:22:20 DEBUG [Producer clientId=producer-1] Starting Kafka producer I/O thread.

2020-03-22 22:22:20 DEBUG [Producer clientId=producer-1] Initialize connection to node localhost:9092 

(id: -1 rack: null) for sending metadata request

2020-03-22 22:22:20 DEBUG [Producer clientId=producer-1] Initiating connection to node localhost:9092 

(id: -1 rack: null) using address localhost/127.0.0.1

log4j.properties :

log4j.logger.logGen=TRACE, Kafka

log4j.appender.Kafka=org.apache.kafka.log4jappender.KafkaLog4jAppender
log4j.appender.Kafka.topic=kafka
log4j.appender.Kafka.brokerList=localhost:9092
log4j.appender.Kafka.layout=org.apache.log4j.PatternLayout
log4j.appender.Kafka.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n

KafkaClass . scala

import org.apache.log4j._

object KafkaClass extends App {

  val logger = Logger.getLogger(this.getClass.getName)

  logger.info("kafka info")
  logger.error("kafka error")
  logger.warn("kafka warn")

}

Не вижу, в чем проблема, спасибо за помощь

Обновление: у меня есть это сообщение:

2020-03-24 14:27:17 DEBUG [Producer clientId=producer-1] Starting Kafka producer I/O thread.
2020-03-24 14:27:17 DEBUG [Producer clientId=producer-1] Initialize connection to node localhost:9092 (id: -1 rack: null) for sending metadata request
2020-03-24 14:27:17 DEBUG [Producer clientId=producer-1] Initiating connection to node localhost:9092 (id: -1 rack: null) using address localhost/127.0.0.1
2020-03-24 14:27:17 DEBUG Added sensor with name node--1.bytes-sent
2020-03-24 14:27:17 DEBUG Added sensor with name node--1.bytes-received
2020-03-24 14:27:17 DEBUG Added sensor with name node--1.latency
2020-03-24 14:27:17 DEBUG [Producer clientId=producer-1] Created socket with SO_RCVBUF = 32768, SO_SNDBUF = 131072, SO_TIMEOUT = 0 to node -1

но все еще не получаю сообщение от потребителя

...