slf4j で logback を使用してコンソール ロガーをセットアップしようとしています。私のログバック構成は次のとおりです。
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>
<logger name="org.hibernate" level="INFO" />
<logger name="com.myapp" level="TRACE" />
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
Logback は問題なくセットアップされているように見えますが、ロガーからコンソールに出力を取得できないようです。アプリで LOGGER.isInfoEnabled() が true を返すことをテストしました。
Logback の StatusPrinter の出力:
17:25:11,736 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
17:25:11,737 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/Users/ryanspicer/NetBeansProjects/Oncewhen/build/classes/logback.xml]
17:25:11,996 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
17:25:11,996 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
17:25:12,000 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
17:25:12,038 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@12:74 - no applicable action for [encoder], current pattern is [[configuration][appender][encoder]]
17:25:12,038 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@13:16 - no applicable action for [pattern], current pattern is [[configuration][appender][encoder][pattern]]
17:25:12,038 |-ERROR in ch.qos.logback.core.ConsoleAppender[STDOUT] - No layout set for the appender named "STDOUT".
17:25:12,038 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [STDOUT] from the object stack
17:25:12,038 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate] to INFO
17:25:12,038 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.hibernate] to true
17:25:12,038 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.myapp] to TRACE
17:25:12,038 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.myapp] to true
17:25:12,038 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
17:25:12,038 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[root]
ここで何が起こっているのか、それを修正して作業ログ出力を取得する方法はありますか?