How to set CATALINA_HOME in log4j.xml?

后端 未结 3 1129
梦毁少年i
梦毁少年i 2021-02-14 01:48

I need something like this:

\"param name=\"File\" value=\"${CATALINA_HOME}/logs/log4j.log\"

I saw a lot of similar questions, but there is no working solutions

3条回答
  •  鱼传尺愫
    2021-02-14 02:19

    For Tomcat 6.0 or newer use catalina.base (rather than catalina.home):

    param name="File" value="${catalina.base}/logs/log4j.log"

    Depending on the host system, the two may be different, for example:

    catalina.home: /usr/share/tomcat7
    catalina.base: /var/lib/tomcat7 
    

    Under catalina.home there's the bin folder.

    Under catalina.base there are conf, logs, webapps and other folders/links.

    Tomcat uses catalina.base itself to configure the logging directory - see conf/logging.properties where it says:

    1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
    

提交回复
热议问题