Log4j2.xml not found but log4j2-test.xml is
Since log4j2-test.xml
has a higher load precedence than log4j2.xml
, you probably have another log4j2 configuration file somewhere on your classpath that's overriding your log4j2.xml
. Try finding the location of which conf file is getting pulled by having the following code execute when you run your maven test build:
for (String confFile : Arrays.asList("/log4j2-test.xml", "/log4j2.yaml", "/log4j2.yml", "/log4j2.json", "/log4j2.jsn", "/log4j2.xml")) { URL resource = YourTestClass.class.getResource(confFile); if (resource != null) { System.out.format("found %s in: %s\n", confFile, resource.getFile()); }}