External log4j.xml file

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

    "-jar" only uses the classpath inside the executable jar, and -cp is ignored. Adding "." to the classpath in the executable jar should allow log4j.xml to be fount.

提交回复
热议问题