I am creating an executable JAR that uses a pair of XML configuration files, one for the application and one for log4j. To reference the application configuration file, I do the following:
InputStream config = Util.class.getResourceAsStream("/config/config.xml");
This works fine for my application, but the problem is that I cannot configure log4j like that. Here is the code that configures log4j:
DOMConfigurator.configure("/config/log4j.xml");
This will not work because the XML file will be stored in the JAR package. How to configure log4j to use an XML file or properties in a JAR?
source share