ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
我的层次结构是这样的
App -> src -> main -> resources -> log4j.xml
App -> src -> test -> test-resources -> log4j.xml
我的测试类使用此配置运行
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:**/beans-common.xml", "classpath:/beans.xml", "classpath:/dao.xml",
"classpath:/service-config.xml"})
知道我在这里缺少什么吗?
最佳答案
请将配置文件重命名为 log4j2.xml
或 log4j2-test.xml
。
如果这些文件位于类路径中,Log4j2 将找到它们。 (它会首先寻找测试。)
您的配置文件名为 log4j.xml
(缺少“2”)。
关于java - Log4j2 - 未找到 Spring 测试记录器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28314116/