External log4j.xml file

后端 未结 9 639
忘了有多久
忘了有多久 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

    For log4j2, use configurationFile option:

    java -Dlog4j.configurationFile=/path/to/log4j2.xml -jar ...
    

    http://logging.apache.org/log4j/2.0/manual/configuration.html

提交回复
热议问题