How to set CATALINA_HOME in log4j.xml?

后端 未结 3 1125
梦毁少年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:30

    You can do the following:

    1. send the CATALINA_HOME as an environment variable using -D option. You just have to run

    set JAVA_OPTS=%JAVA_OPTS% -DCATALINA_HOME=%CATALINA_HOME% if you are on windows or export JAVA_OPTS=${JAVA_OPTS} -DCATALINA_HOME=$CATALINA_HOME for unix.

    Now just use ${CATALINA_HOME} into your log4j configuration file and this should work.

提交回复
热议问题