I’m trying to configure logging for my web application (WAR), in log4j.properties:
log4j.rootCategory=WARN, RF
log4j.appender.RF=org.apache.log4j.RollingFileAppender
log4j.appender.RF.File=???/my-app.log
What file path I should specify for my-app.log? Where to keep this file? Currently I’m deploying my application to Tomcat6, but who knows what happens in the future. And who knows how exactly Tomcat will be configured/installed on another machine, in the future.
What I finally did is this:
settings.xmlI define a propertylog.dirlog4j.propertiesI define:log4j.appender.RF.File=${log.dir}/my-app.logpom.xmlI instruct Maven to filter.propertiesfilesThat’s it. Now I can control the location of my log files on the destination container without any changes to the source code.