I was fortunate enough to use log4j in junit with this setup when working in Eclipse or through Hudson. This may not work with the combination of tests / runners / IDEs you use, as this does not work in all cases for me. You may need to configure forkMode. You will also have to create hard codes.
<plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <forkMode>never</forkMode> <systemProperties> <property> <name>log4j.configuration</name> <value>file:src/test/resources/log4j.xml</value> </property> </systemProperties> </configuration> </plugin>
Another might be to use redirectTestOutputToFile to output stdout to the surefire report file. They havenβt used it, so I donβt know if this will work for you either.
source share