ここで何が間違っているのかわかりませんが、ログがオフになっているようです。私は使っている
slf1.7.2 ログバック 1.0.9
ここに私の設定ファイルがあります:
<configuration debug="true">
<contextName>myProduct</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%msg%n</pattern>
</encoder>
</appender>
<appender name="ROLLINGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>../logs/myproduct.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>../logs/myproduct-%d{yyyy-DD}.%i.zip
</fileNamePattern>
<maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%date{HH:mm:ss.SSS} %-5level %logger{40} [%file:%line] -
%msg%n</pattern>
</encoder>
</appender>
<root>
<appender-ref ref="ROLLINGFILE" />
</root>
<logger name="org.hibernate" level="error">
<appender-ref ref="ROLLINGFILE" />
</logger>
<logger name="org.springframework" level="error">
<appender-ref ref="ROLLINGFILE" />
</logger>
<logger name="com.edelweissco" level="error">
<appender-ref ref="ROLLINGFILE" />
<appender-ref ref="STDOUT" />
</logger>
</configuration>
しかし、アプリケーションをデプロイすると、Spring と Hibernate を ERROR に設定してもコンソールにログが記録され、コンソールにはログ ステートメントが表示されます。ファイル システムのどの場所にもログ ファイルが作成されていませんが、エラーは発生しません。
起動時のコンソール出力は次のとおりです。
21:28:34,276 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
21:28:34,276 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [file:/Library/Tomcat/apache-tomcat-7.0.27/webapps/myapplication/WEB-INF/classes/logback-test.xml]
21:28:34,340 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [myProduct]
21:28:34,341 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
21:28:34,346 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
21:28:34,406 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
21:28:34,412 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [ROLLINGFILE]
21:28:34,450 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
21:28:34,454 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern ../logs/myproduct-%d{yyyy-DD}.%i for the active file
21:28:34,460 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@38a3c5b6 - The date pattern is 'yyyy-DD' from file name pattern '../logs/myproduct-%d{yyyy-DD}.%i.zip'.
21:28:34,460 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@38a3c5b6 - Roll-over at midnight.
21:28:34,460 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@38a3c5b6 - Setting initial period to Thu Jan 10 20:42:21 MST 2013
21:28:34,464 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
21:28:34,469 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ROLLINGFILE] - Active log file name: ../logs/myproduct.log
21:28:34,469 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ROLLINGFILE] - File property is set to [../logs/myproduct.log]
21:28:34,471 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ROLLINGFILE] to Logger[ROOT]
21:28:34,473 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate] to ERROR
21:28:34,474 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ROLLINGFILE] to Logger[org.hibernate]
21:28:34,474 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework] to ERROR
21:28:34,474 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ROLLINGFILE] to Logger[org.springframework]
21:28:34,474 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.edelweissco] to ERROR
21:28:34,474 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ROLLINGFILE] to Logger[com.edelweissco]
21:28:34,474 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.edelweissco]
21:28:34,475 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
21:28:34,477 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6f92c766 - Registering current configuration as safe fallback point
Jan 12, 2013 9:28:34 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
出力にエラーはありませんが、ログは構成ファイルを正しく使用しているようには見えません。