Ich benutze Hibernate 3.1.3 und Logback (Classic + Core) 1.1.7.Hibernate + Logback, nicht einloggen Datei
Hier sind meine logback.xml
<appender name="hibernate-sql"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/hibernate-sql.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>c:/temp/hibernate-sql.%i.log.zip</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>10</MaxIndex>
</rollingPolicy>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>2MB</MaxFileSize>
</triggeringPolicy>
</appender>
<logger name="org.hibernate.hql">
<level value="TRACE"/>
<appender-ref ref="hibernate-sql"/>
</logger>
<logger name="org.hibernate.SQL">
<level value="TRACE"/>
<appender-ref ref="hibernate-sql"/>
</logger>
<root level="TRACE">
<!--<appender-ref ref="FILE"/>-->
<!--<appender-ref ref="STDOUT"/>-->
</root>
ich SQL in meiner IDE Konsole angemeldet bekommen (wegen hibernate.show_sql = true
), aber nicht in logs/Hibernate-Sql.log. Die Datei ist gut erstellt, bleibt aber leer.
Hier sind die Debug-Informationen über logback:
12:34:43,301 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
12:34:43,301 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
12:34:43,301 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/******/logback.xml]
12:34:43,535 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
12:34:43,543 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [hibernate-sql]
12:34:43,668 |-INFO in [email protected] - Will use zip compression
12:34:43,678 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[hibernate-sql] - Active log file name: logs/hibernate-sql.log
12:34:43,679 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[hibernate-sql] - File property is set to [logs/hibernate-sql.log]
12:34:43,684 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.hibernate.hql level set to TRACE
12:34:43,684 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [hibernate-sql] to Logger[org.hibernate.hql]
12:34:43,685 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.hibernate.SQL level set to TRACE
12:34:43,685 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [hibernate-sql] to Logger[org.hibernate.SQL]
12:34:43,686 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
12:34:43,686 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
12:34:43,687 |-INFO in [email protected] - Registering current configuration as safe fallback point
Warum ist es in der Konsole anmelden, aber nicht in meiner Datei, auch wenn es gut die Datei erstellt? Vielen Dank.
Ich füge Debug hinzu und füge das Log über Logback im ursprünglichen Beitrag hinzu – Jon