Forum Moderators: phranque
I am trying to configure log4j for a JSP application deployed to tomcat. It is basically successful for me but it's not as portable as I want it to be.
In log4j, I can specify a path to the output file like this:
log4j.appender.MyLogger.File = /usr/local/jakarta-tomcat-5.0.28/webapps/MyApplication/log/output
This does work in my case. However, if I deploy it to another computer, the tomcat my be installed in a different directory instead of /usr/local/jakarta-tomcat-5.0.28/. If that's the case, the log file won't be generated properly.
For my deployment, the application root is: "/usr/local/jakarta-tomcat-5.0.28/webapps/MyApplication/". So it will be great if I can write something like:
log4j.appender.MyLogger.File = ${ApplicationRoot}/log/output
Is there a way to write log4j.properites so that the file name I use is relative to the application directory's root?