Reputation: 211
I want lo log hibernate generated sql queries using logback logging framework, but problem is that it is generating log file but not logging anything related to hibernate.
This is how logback.xml looks like
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${Project_HOME}\\module\\logs\\module.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${Project_HOME}\\module\\logs\\module_%d{yyyy- MM-dd}.%i.log.zip
</fileNamePattern>
<maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10KB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%date %-5level [%file:%line] - %msg%n
</pattern>
</encoder>
</appender>
<logger name="org.hibernate.SQL">
<level value="DEBUG" />
<appender-ref ref="FILE" />
</logger>
Also all other logging using same appender is working fine.
Upvotes: 2
Views: 1035
Reputation: 10848
I would recommend you change your logger config a little:
<logger name="org.hibernate">
<level value="info"/>
</logger>
Upvotes: 1
Reputation: 292
I would suggest you to add a property in hibernate-cfg.xml
<property name="show_sql">true</property>
Hope this will help you .
Upvotes: 2