I have a web-API that deploys on a tomcat. I want to use log4j2 to print from the the API so I can track the calls that made to the API.
The war-file will be deployed on different machines with tomcat. I want to be able to place the log4j.properties file in a place where I don't overwrite it each time I make a new deploy.
As I've understood it the log4j.properties files should be placed in src/main/rescources when using maven (I am using maven). When I place the file in that folder I get log4j2 working. However if I make a new deploy the log4j.properties-file will be overwritten.
Is there anyway to place the log4j.propterties file outside that folder when I use Maven? Perhaps in the tomcat folder?
I've tried to make changes in the pom.xml. I tried to change the location in two places.
<log4j.configuration>./conf/log4j.properties</log4j.configuration>
And
<resources>
<resource>
<directory>src/main/resources</directory>
<targetPath>${project.build.directory}</targetPath>
<includes>
<include>log4j.properties</include>
</includes>
</resource>
</resources>
I tried just changing the location in one of these at a time and in both of them in the same time. I tried to put the log4j.properties in the tomcat catalog.
I don't know if this is possible to do when you're using maven. Anyone who knows and can help?