I am trying to create two log4j.xml files - one for testing, one for production.
E.g.
- log4j-test.xml
- log4j-prod.xml
After googling I found that, it is necessary to specify the path in conf file, in order to choose which one to use. But even when I specify it like
application.log.path=/log4j-test.xml
it still tries to look for log4j.xml, which, as far as I understand is the default (as in the project it is not specified anywhere) and I get
log4j:WARN No appenders could be found for logger (application).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I checked the link given but it did not contain info for my case.
So - if the file name is log4j.xml everything works, but if I try to rename it to log4j-test.xml and specify the path in application.conf file, it gives the warning above and logging does not work.
The main reason why I need two different configurations is that in test environment I want to use one set of appenders, but for production a different set of appenders. (If there is a different way of achieving this than with multiple log4j configuration xml's please, give advice)
Any help appreciated!