Reputation: 2114
I am using logback for my custom logging purposes. I also integrated Hibernate to my application. Now I am trying to disable or set the level of Hibernate logging with no luck. I tried to to add the following properties in my hibernate.cfg.xml file but nothing changed.
<property name="show_sql">false</property>
<property name="hibernate.generate_statistics">false</property>
<property name="hibernate.use_sql_comments">false</property>
Here is also my hibernate.cfg.xml :
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">
org.hibernate.dialect.HSQLDialect
</property>
<property name="hibernate.connection.driver_class">
org.hsqldb.jdbcDriver
</property>
<!-- Assume students is the database name -->
<property name="hibernate.connection.url">
jdbc:hsqldb:mem:testdb
</property>
<property name="hibernate.connection.username">
SA
</property>
<property name="show_sql">false</property>
<property name="hibernate.generate_statistics">false</property>
<property name="hibernate.use_sql_comments">false</property>
<property name="hibernate.connection.password">
</property>
<property name="hbm2ddl.auto">create</property>
</session-factory>
</hibernate-configuration>
Here is also my logback.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>classname</key>
<defaultValue>unknown</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${classname}" class="ch.qos.logback.core.FileAppender">
<append>false</append>
<file>${classname}.log</file>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{HH:mm:ss:SSS} | %-5level | %thread | %logger{20} | %msg%n%rEx</pattern>
</layout>
</appender>
</sift>
</appender>
<root level="ALL">
<appender-ref ref="SIFT"/>
</root>
</configuration>
Upvotes: 0
Views: 1294
Reputation: 48015
Add this ...
<logger name="org.hibernate" level="OFF"/>
... to your logback.xml
This will instruct Logback to ignore all log events emitted by Logger instances from the org.hibernate
namespace.
Upvotes: 4