Multiple log4j xml files for multiple applications
I have 5 applications which have different log4j xml configuration file. And I w开发者_运维百科ant each of them to be configured according to the given file and logs correctly when called from one main method.
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);
精彩评论