Since some time I run several instances of the same application on a tomcat server. This is the poor man's approach of multi-tenancy, I'd prefer to change the application to really support multiple tenants, but that'll take some time.
The main problem was that everything was logged in the same log file unless I change the log4j.properties before deploying to Tomcat. I therefore wanted to change the log file location dynamically.
The very small example below shows how to change the log file for a FileAppender while using the commons logging from Apache.