1
我CDI基礎的測試使用以下依賴性:配置日誌記錄Deltaspike試驗控制
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-test-control-module-api</artifactId>
<version>1.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-test-control-module-impl</artifactId>
<version>1.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.cdictrl</groupId>
<artifactId>deltaspike-cdictrl-weld</artifactId>
<version>1.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>2.2.13.Final</version>
<scope>test</scope>
</dependency>
這些都是我的logging.properties:
.handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$-6s %2$s %5$s%6$s%n
.level=INFO
java.util.logging.ConsoleHandler.level=INFO
運行測試當我有這些日誌消息:
2016-04-24 11:10:32 INFORMATION org.apache.deltaspike.core.util.ProjectStageProducer initProjectStage Computed the following DeltaSpike ProjectStage: Production
2016-04-24 11:10:33 INFORMATION org.apache.deltaspike.core.api.config.PropertyLoader loadAllProperties could not find any property files with name META-INF/apache-deltaspike_test-container
2016-04-24 11:10:34 INFORMATION org.apache.deltaspike.testcontrol.api.junit.CdiTestSuiteRunner$LogRunListener testStarted [run] com.foo.Bar#someMethod
2016-04-24 11:10:34 INFORMATION org.apache.deltaspike.testcontrol.api.junit.CdiTestSuiteRunner$LogRunListener testFinished [finished] com.foo.Bar#someMethod
我不需要這些消息,所以我在logging.properties中添加了以下配置:
org.apache.deltaspike.level=WARNING
現在前兩行不見了。我如何擺脫CdiTestSuiteRunner$LogRunListener
消息?
注:我可以擺脫與以下配置這些消息:
java.util.logging.ConsoleHandler.level=WARNING
但是這oviously不是我想要的。