Reputation: 23352
I have 5 applications which have different log4j xml configuration file. And I want each of them to be configured according to the given file and logs correctly when called from one main method.
Upvotes: 0
Views: 2757
Reputation: 18445
Log4j will automatically look for and use config files it finds on the classpath. It looks for files called log4j.properties
and log4j.xml
and possibly others.
Alternatively you can programatically load config using;
String filename = "/path/to/config/file.xml";
DOMConfigurator.configure(filename);
Upvotes: 2