Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

Multiple log4j xml files for multiple applications

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

Answers (1)

Qwerky
Qwerky

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

Related Questions