2013-11-28 48 views
2

我的logback的文件的外部配置上我的文件系統:的logback設置在正常發揮的框架

<configuration> 

.... 

<root level="OFF"> 
</root> 

.... 

</configuration> 

我指定與JVM參數文件位置:-Dlogger.file=/path/to/my/file/logger.xml

但是當我運行應用程序的測試時,我看到的第一行是從記錄器輸出的。

 
17:42:17,211 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 
17:42:17,212 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 
17:42:17,212 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/jakubryska/.ivy2/cache/com.typesafe.play/play_2.10/jars/play_2.10-2.2.1.jar!/logback.xml] 
17:42:17,228 |-INFO in [email protected] - URL [jar:file:/Users/jakubryska/.ivy2/cache/com.typesafe.play/play_2.10/jars/play_2.10-2.2.1.jar!/logback.xml] is not of type file 
17:42:17,383 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 
17:42:17,384 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 
17:42:17,392 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 
17:42:17,412 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 
17:42:17,467 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR 
顯然,我在做一件不好的事情。我希望記錄儀沒有輸出。它是什麼?

回答

4

其實我已經注意到Play測試本身有類似的問題,它似乎都依賴於測試訂單執行,我從來沒有注意到它。您可以使用的一種解決方案是創建一個src/test/resources/application-logger.xml文件,這可能會或可能不適合您的最終目標。

我確實認爲我們需要在Play中對日誌配置進行大修,目前的情況相當混亂。