'Java / Tomcat / Log4J: override log4j.properties

I have an old application written with Java8.

It is a maven application (it has a pom.xml file) but, overall, it runs inside Tomcat 8.

I have a log4j.properties file under /src/main/resources directory. Inside that log4j property, there is a property: log4j.appender.file.File=/home/customuser/logs/app.log

I want override that property when I develop in my local machine. Of course I don't have /home/whateveruser neither I want to create that folder.

I don't want edit and undo that file 'cause is under git versioning and now or later somebody could edit, push and destroy test / production servers.

I can edit my development Tomcat setup. I did try to setup a VM arguments as "-DLOG4J_CONFIGURATION_FILE="/home/sineverba/log4j.properties" (see this answer here) but seems that this particular vm arguments is not respected.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source