Maven 项目添加Log4j.xml 配置文件
把log4j.xml 改名log4j-test.xml,然后放到src/test/resources 文件夹下
这样就可以读到了
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>test-log4j.xml</include>
</includes>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<systemProperties>
<property>
<name>log4j.configuration</name>
<value>test-log4j.xml</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>