Set up kafka appender in log4j2.properties

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Set up kafka appender in log4j2.properties

Fanshu
Hi,

I'm updating my application to use log4j2 from log4j 1.x, and wondering if anyone has experience setting up Kafka Appender with properties file in log4j2? Log4j2 seems to define properties with name-value pairs, an official code sample suggested doing the following way, and it's working.
appender.kafka.property.name=bootstrap.servers
appender.kafka.property.value=myhost:9092
But to add a few more kafka properties, it feels weird to just add more name-value pairs as in the code below and it's not working either. I didn't find much information about configuring kafka appender with log4j2.properties, most are using XML. Would appreciate any suggestions!
appender.kafka.property.name=compression.type
appender.kafka.property.value=gzip

appender.kafka.property.name=linger.ms
appender.kafka.property.value=200
Fanshu