How can Change log4j configuration file path?

418 views Asked by At

I am working on a maven project, i put the log4j.xml in this path: /src/main/java/log4j.xml and it is working correctly, Can i move the log4j.xml configuration file to /src/main/resources/ ?? what is the new configurations will be?

1

There are 1 answers

0
1337joe On

Log4j reads its properties file from the classpath, so your properties file can be placed anywhere that's on the classpath without needing any configuration change to tell it where to look. Anything placed in /src/main/java and /src/main/resources ends up on the artifact classpath when maven builds, but /src/main/resources is the more appropriate place for a resource (anything that isn't compiled).