External log4j.xml file

后端 未结 9 650
忘了有多久
忘了有多久 2020-12-12 22:32

I am trying to run a jar with the log4j.xml file on the file system outside the jar like so:

java -jar MyJarName.jar -cp=/opt/companyName/pathToJar/ log4j.co         


        
9条回答
  •  别那么骄傲
    2020-12-12 22:45

    I had problems using log4j with Sun's JDK and automatic configuration.

    You can use this:

    String filename = System.getProperty("log4j.configuration");
    DOMConfigurator(filename);
    

    before using Logger.

提交回复
热议问题