java虚拟机加载log4j的类(LogManager.class)后,执行静态代码块,这个类中的静态代码块,会load log4j的配置文件,依次加载log4j.xml,log4j.properties
部分代码:
static public final String DEFAULT_CONFIGURATION_FILE = "log4j.properties";
static final String DEFAULT_XML_CONFIGURATION_FILE = "log4j.xml";
if(configurationOptionStr == null) {
url = Loader.getResource(DEFAULT_XML_CONFIGURATION_FILE);
if(url == null) {
url = Loader.getResource(DEFAULT_CONFIGURATION_FILE);
}