I've already set
<property name="show_sql">false</property>
and I have disabled all messages in log4j.properties
But Hibernate write to console with all queries & statements.
Hibernate uses Simple Logging Facade for Java (SLF4J) to redirect the logging output to your perfer logging frameworkis (log4j, JCL, JDK logging, lofback…).
The jboss-logging jar is a required dependency of Hibernate and therefore will always need to be on the classpath.
Logging. Hibernate utilizes Simple Logging Facade for Java (SLF4J) in order to log various system events.
Setting the hibernate.show_sql
to true
tells hibernate to Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL
to debug.
So even if you set this property to false
, make sure that you don't have the following category defined (or configured to use a console appender):
log4j.logger.org.hibernate.SQL=DEBUG
Also, make sure that you don't set the hibernate.show_sql
programmatically to true when instancing your Configuration
object. Hunt something like this:
Configuration cfg = new Configuration().configure(). .setProperty("hibernate.show_sql", "true");
Note that the setProperty(String propertyName, String value)
takes as first parameter the full name of a configuration property i.e. hibernate.show_sql
, not just show_sql
.
HI there, i figured out you can solve this also with this 2 lines in your log4j.properties file.
log4j.logger.org.hibernate = WARN log4j.logger.org.hibernate = ERROR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With