简体   繁体   中英

How to load multiple log4j xml files programatically in spring without using xml configuration

I tried using

Log4jConfigurer.initLogging(firstFile,6000);
Log4jConfigurer.initLogging(nextFile,6000);

but the second file overrides the configuration of first

Programatically, you can merge 2 or more XML files into a single XML, and load it into Log4j.

Also, Log4Configurer.initLogging() is deprecated, but there is another way: - DOMConfigurator.configure(Element element);

Using JDom or some other library, you can load/parse your two XML files, merge them to get a single XML Element, and pass it to the above method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM