Getting Log4J to pick up the right configuration file via the classpath is always annoying. Fortunately, there’s an easy solution.
All you need to do is specify the
log4j.configuration system property when you launch JUnit. The value should be the path to the
log4j.xml file you wish to use. Here’s an example:
To quote Nick: Hopefully this helps somebody else.