I have an application that deploys 4 separate war files, each requiring a customized log4j2.xml file (this makes using -Dlog4j.configurationLocation=_____ impractical).
What I need to do is to be able to configure these on a per-WAR basis, in a filesystem location named /application/config/. This should be possible via the servlet initializer as such:
@Override
public void onStartup(ServletContext servletContext) {
// other code
servletContext.setInitParameter("log4jConfiguration", "file:/application/config/log4j2-module1.xml");
// other code
}
I have added log4j-web to the POM, but I'm still having no luck. I've looked through all of the other people asking similar questions, and nothing. I've also created a Listener specifically to initialize log4j, and still nothing.
Can anyone point out what I'm doing wrong? This is a Spring (but not Spring Boot) application, so I can't just make a change to application.properties.