I've an application to migrate log4j dependency to log4j2 XML file based with name myAppLog4j.xml
Here is the current loading of log4j,
import org.apache.log4j.xml.DOMConfigurator;
...
public static void loadLog4j(String name) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
DOMConfigurator.configure(loader.getResource(name));
}
Where name
argument to the method is the XML file name.
Now I'm using log4j2 2.17.1 which don't have DOM class. Can someone help how to get the same thing accomplished in log4j2.
I don't want to mess with classpath and system properties. Any help is appreciated.