iT邦幫忙

0

log4j (1.2) log to kafka (2.4.0) tomcat server 重啟咬住

wjt 2020-08-20 16:17:34290 瀏覽

Hi 各位前輩好

想請問一下,目前我的架構是將java log4j log訊息往kafka去送,這一段已經實作成功,但我只要將kafka services shutdown後,tomcat server重啟就會咬住,停在下列訊息

log4j:WARN No appenders could be found for logger (org.apache.kafka.clients.producer.ProducerConfig).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

目前log4j 針對 kafka的設定如下:
log4j.rootLogger=INFO, kafkalog
log4j.logger.org.apache.kafka=WARN
log4j.appender.kafkalog=org.apache.kafka.log4jappender.KafkaLog4jAppender
log4j.appender.kafkalog.topic=test
log4j.appender.kafkalog.brokerList=ip:9092
log4j.appender.kafkalog.compressionType=none
log4j.appender.kafkalog.requiredNumAcks=0
log4j.appender.kafkalog.syncSend=false
log4j.appender.kafkalog.layout=org.apache.log4j.PatternLayout
log4j.appender.kafkalog.layout.ConversionPattern=%m

猜測是因為kafka services shutdown,tomcat log4j 送不過去所以才會產生咬住之情形

有沒有辦法設定了rootlogger kafka,將kafka shutdown後,能夠不送log到kafka的方法呢
找不太到相關文獻及網路資訊。

感謝願意回覆之人。

尚未有邦友回答

立即登入回答