I use this setup which works for me (Idea 5.1 / Maven 1.0.2) and looks like it covers what you want:
Put the appropriate log4j.properties file in: 1. main/resources 2. test/resources 3. test/java (plus the relevant resource location definition in the pom for 1 & 2) So for me 3 always gets precedence over 1 & 2 when running in the IDE and 2 gets precedence over 1 when running the tests under maven. The only limitation is that if you don't do a clean before running the tests then 3 can get precedence when running the tests under maven if you've run the tests in the IDE. A fairly simple solution to this is to call file 2 maven-log4j.properties, and then in your project.properties add: maven.junit.sysproperties=log4j.configuration log4j.configuration=maven-log4j.properties Hope that helps James On 6/10/06, Jimisola Laursen <[EMAIL PROTECTED]> wrote: > > > Hi! > > I've seen various posts on log4j and Maven, but I haven't seen any > answer to what I want to do. I want to be able to use different > settings for log4j > for: > > 1. main (releases using mvn assembly) > 2. tests (unit tests) > 3. development (when running/debugging the program within Eclipse or > outside with more extra logging) > > I know that I should place log4j.properties under main/resources and > test/resources. This will hopefully solve 1) and 2) . However, I read > something about Maven giving precedence to main/resources instead of > test/resources - is that still the case? > > I would like to avoid a long line of system properties on the command > line since they're easy to forget and especially for new develepors to > get. I'd then prefer to just add one "environment" property (main, > test, > development) > which can then be used throughout our Maven environment in case we > have similiar situations. > > Any ideas? > > Regards, > Jimisola > -- > View this message in context: > http://www.nabble.com/How-to-setup-log4j-with-different-settings-for-m > ain%2C-test-and-developmen-t1766805.html#a4808936 > Sent from the Maven - Users forum at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > ------------------------------------------------------------------------------ This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
