我正在尝试配置 Kafka 9
提供 KafkaLog4jAppender
与 log4j2.xml
.
我的log4j2.xml文件类似于this:-
<?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="org.apache.kafka.log4jappender"
status="INFO">
<Appenders>
<Kafka name="Kafka" topic="log-test">
<PatternLayout pattern="%date %message" />
<Property name="bootstrap.servers">localhost:9092</Property>
</Kafka>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Kafka" />
</Root>
<Logger name="org.apache.kafka" level="INFO" />
</Loggers>
</Configuration>
我的日志输出是
2016-03-08 12:14:27,480 ERROR Error processing element Kafka: CLASS_NOT_FOUND
2016-03-08 12:14:27,520 ERROR Unable to locate appender Kafka for logger
如何指定 KafkaLog4jAppender
?
是我使用log4j1的唯一选择吗?
1条答案
按热度按时间4ktjp1zp1#
已通过修复此问题
Apache Log4j 2.5