Log4j Properties in a Custom Place

后端 未结 3 989
梦如初夏
梦如初夏 2020-12-15 08:50

I\'m using Apache Commons Logging and SLF4J with log4j, but I also want to use the log4j.properties in a custom place like conf/log4.properties. Here is the problem:

3条回答
  •  难免孤独
    2020-12-15 09:33

    I think the easiest thing to do is specify the location of the file using the log4j.configuration system property. Adopting the example in the Log4J manual:

    java -Dlog4j.configuration=conf/log4j.properties -classpath ...
    

    I believe that Log4J will find a file named "log4j.properties" anywhere on the classpath, but may be hallucinating. Worth trying, however.

提交回复
热议问题