huahsin68
huahsin68

Reputation: 6989

How should the log4j.properties put inside the war file using ANT build tool?

I have a log4j.properties that sit right under the src folder. When I building my war file using ANT tool, the particular properties file wasn't pack inside WEB-INF/classes folder, and it was right under the "root" directory of the war file (if you unwar it). I heard from my colleague mention that this is not correct. May I know is this true? If no, how should I correct it?

THanks @!

Upvotes: 4

Views: 3883

Answers (1)

ziesemer
ziesemer

Reputation: 28697

Yes, log4j.properties (or any other resource loaded from the classpath) should be at the root of your Java source folder (src/main/java, build/main, src, JavaSource, or however you have your project configured).

In the WAR, it should be under WEB-INF/classes, not at the root (as if you unzipped it).

If this is not the case, being able to see your ANT build file would be very helpful. You should have something like this line configured within your war task:

<classes dir="build/main"/>

As long as you have a build/main/log4j.properties in your Ant basedir, this should work as you're expecting.

Upvotes: 4

Related Questions