How to initialize log4j properly?

前端 未结 24 3314
太阳男子
太阳男子 2020-11-22 06:49

After adding log4j to my application I get the following output every time I execute my application:

log4j:WARN No appenders could be found for logger (slideselec         


        
24条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 07:16

    While setting up log4j properly is great for "real" projects you might want a quick-and-dirty solution, e.g. if you're just testing a new library.

    If so a call to the static method

    org.apache.log4j.BasicConfigurator.configure();
    

    will setup basic logging to the console, and the error messages will be gone.

提交回复
热议问题