简体   繁体   中英

Log4j2 - Spring Test logger not found

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

My hierarchy is this way

App -> src -> main -> resources -> log4j.xml
App -> src -> test -> test-resources -> log4j.xml

And My Test class runs with this configuration

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:**/beans-common.xml", "classpath:/beans.xml", "classpath:/dao.xml",
    "classpath:/service-config.xml"})

Any idea, what I am missing here?

Please rename the config file to log4j2.xml or log4j2-test.xml . Log4j2 will find those files if they are in the classpath. (It will look for the test one first.)

Your config files are named log4j.xml (they're missing the '2').

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM