For the newest version of log4j, here is what should work for loading an external log4j2.xml
:
String log4jConfigFile = System.getProperty("user.dir") + File.separator + "log4j2.xml";
ConfigurationSource source = new ConfigurationSource(new FileInputStream(log4jConfigFile));
Configurator.initialize(null, source);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…