you may have a log4j configuration specific to your tests.
Step 1: create the src / test / resources / test-log4j.properties file containing the log4j configuration for your tests.
Example:
log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.ConsoleAppender log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{3}:%L - %m%n
Step 2: edit your pom.xml as follows:
<build> ... <plugins> <plugin> <artifactid>maven-surefire-plugin</artifactid> <version>2.3</version> <configuration> <systemproperties> <property> <name>log4j.configuration</name> <value>test-log4j.properties</value> </property> </systemproperties> </configuration> </plugin> ... </plugins> </build>
Now your log4j.properties is in src / main / webapp / WEB-INF / classes /
Hope this helps.
Harish raj
source share