I don't think the log4j appender supports patterns :(

On Sep 22, 2014 1:14 PM, Lakshmanan Muthuraman <lakshma...@tokbox.com> wrote:
Hello ,

I am trying to use KafkaLog4jAppender to write to kafka and also a file
appender to write to a file. The conversion pattern works for the file, but
for the kafka appender it is not working

The output of the file appender is *2014-09-19T22:30:14.781Z INFO
com.test.poc.StartProgram Message1*But the Kafka appender has output as
*Message1*

Find below my log4j.properties file

log4j.rootCategory=INFO
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.file.File=logs/test.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}{UTC}
%p %C %m%n

log4j.logger.com=INFO,file,KAFKA
#Kafka Appender
log4j.appender.KAFKA=kafka.producer.KafkaLog4jAppender
log4j.appender.KAFKA.layout=org.apache.log4j.PatternLayout
log4j.appender.KAFKA.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}{UTC}
%p  %C %m%n

log4j.appender.KAFKA.ProducerType=async
log4j.appender.KAFKA.BrokerList=localhost:9092
log4j.appender.KAFKA.Topic=test`enter code here`
log4j.appender.KAFKA.Serializer=kafka.test.AppenderStringSerializer

Reply via email to