No appenders could be found for logger(log4j)?

2018-12-31 10:05发布

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.hsqlmanager).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

What do these warnings mean? Whats the appender here?

26条回答
荒废的爱情
2楼-- · 2018-12-31 10:46

Make sure your project is open in Eclipse, then click on the "Run" menu at the top of Eclipse and click on the following:

  1. Run

  2. Run Configurations

  3. Classpath (tab)

  4. User Entries

  5. add jar on the right

  6. add log4j jar file

  7. Apply

  8. Run

The error message should no longer appear.

查看更多
骚的不知所云
3楼-- · 2018-12-31 10:47

if you work together with a lot of projects you may face a style problem.

*you have to have one lof4j.properties file and this file is included log properties of other project.

*Beside you can try to put log4j properties files into src path when the project is worked Linux OS, libs of other project and log4.properties files can be under one folder into a location on the classpath.

查看更多
登录 后发表回答