Logback 无法从scalatest maven插件中抑制过多日志
背景 当我从maven运行scala测试时,我面临来自默认记录器的过多日志记录,因为它没有使用正确的日志记录定义获取类路径上的logback.xml 因此,我的maven配置相当通用(根据scalatest maven插件文档) 看起来像这样Logback 无法从scalatest maven插件中抑制过多日志,logback,scalatest-maven-plugin,Logback,Scalatest Maven Plugin,背景 当我从maven运行scala测试时,我面临来自默认记录器的过多日志记录,因为它没有使用正确的日志记录定义获取类路径上的logback.xml 因此,我的maven配置相当通用(根据scalatest maven插件文档) 看起来像这样 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- enable scalatest -->
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>MyProj_TestSuite.txt</filereports>
<forkMode>never</forkMode>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
org.apache.maven.plugins
非常感谢您在pom.xml内部提供的任何帮助。请尝试使用/src/test/resources/logback test.xml
logback配置文件。
它适用于2.0.2版本的scalatest maven插件
<runpath>
${project.basedir}/target/classes
</runpath>
<systemProperties>
<logback.configurationFile> ${project.basedir}/src/main/resources/logback.xml</logback.configurationFile>
</systemProperties>
<argLine>
-Dlogback.configurationFile=src/main/resources/logback.xml
</argLine>
<build>
<testResources>
<testResource>
<directory>${project.basedir}/target/classes</directory>
</testResource>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>