我正在尝试从java应用程序连接到kafka,当我启动该应用程序时,在stdout上收到以下消息:
log4j:WARN No such property [host] in kafka.producer.KafkaLog4jAppender.
log4j:WARN No such property [serializer] in kafka.producer.KafkaLog4jAppender.
log4j:WARN No such property [port] in kafka.producer.KafkaLog4jAppender.
以下是官方快速入门中提供的log4.properties:
// define the kafka log4j appender config parameters
log4j.appender.KAFKA=kafka.producer.KafkaLog4jAppender
// REQUIRED: set the hostname of the kafka server
log4j.appender.KAFKA.Host=hadoop-server
// REQUIRED: set the port on which the Kafka server is listening for connections
log4j.appender.KAFKA.Port=9092
// REQUIRED: the topic under which the logger messages are to be posted
log4j.appender.KAFKA.Topic=test
// the serializer to be used to turn an object into a Kafka message. Defaults to kafka.producer.DefaultStringEncoder
log4j.appender.KAFKA.Serializer=kafka.test.AppenderStringSerializer
// do not set the above KAFKA appender as the root appender
log4j.rootLogger=INFO
// set the logger for your package to be the KAFKA appender
我错过了什么?我该怎么修?
1条答案
按热度按时间hrirmatl1#
用Kafka0.8代替
尝试指定代理列表,如
此外,serializer属性已更改为serializerclass