No appenders could be found for logger(log4j)?

前端 未结 30 2949
[愿得一人]
[愿得一人] 2020-11-22 08:16

I have put log4j to my buildpath, but I get the following message when I run my application:

log4j:WARN No appenders could be found for logger (dao.hsqlmanag         


        
30条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 09:06

    The reason can be lack of the word static in some:

    final static Logger logging = Logger.getLogger(ProcessorTest.class);
    

    If I make logger the instance field, I am getting exactly this very warning:

    No appenders could be found for logger (org.apache.kafka.producer.Sender)
    

    What is worse, the warning points not to ProcessorTest, where the mistake lives, but to an absolutely different class (Sender) as a source of problems. That class has correct set logger and need not any changes! We could look for the problem for ages!

提交回复
热议问题