I want to try and use logj 2 in my web application. With log4j 1.x, we set-up different configuration files based on environment and use ServletContextListener to load the appropriate configuration using a call like
DOMConfigurator.configureAndWatch(logConfigFile, delay);
by passing the config file location.
I was planning on doing the same for log4j2 config file but according to this and this, it is not possible or advisable to use DOMConfigurator with log4j2.
So, my question is: How can I use different configuration files based on environment with log4j 2?
Thanks to Remko Popma, I posted the question and got an answer from log4j user mailing list. One can use a System property or environment variable with 'log4jconfiguration' context-param to dynamically set the configuration file at runtime