I have configured my pom.xml to include slf4j and bindings to log4j and exclude commons-logging as explained here and disabled Hibernate's own logging as explained here.
I can suppress Spring's own messages, but Hibernate messages still come out despite my log4j.properties settings below.
log4j.debug=false
log4j.rootCategory=WARN, stdout
log4j.category.org.hibernate=ERROR, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p %t %c - %m%n
log4j.category.org.springframework = ERROR
log4j.category.org.hibernate = ERROR
Here is my pom.xml file:
What could be the issue? I am seeing all the sql messages hibernate generates.
Enabling Hibernate logs is usually as simple as setting org. hibernate logging level to TRACE or ALL using your logging framework configuration of choice.
As their names suggest, these are the starting dependencies in Spring Boot. This dependency includes JPA API, JPA Implementation, JDBC, and the other necessary libraries. Since the default JPA implementation is Hibernate, this dependency is actually enough to bring it in as well.
Hibernate utilizes Simple Logging Facade for Java (SLF4J) in order to log various system events. SLF4J can direct your logging output to several logging frameworks (NOP, Simple, log4j version 1.2, JDK 1.4 logging, JCL or logback) depending on your chosen binding.
If anyone looks up this question while browsing for answers:
IF you are using spring-boot-starter-data-jpa, set spring.jpa.show_sql = false
in your application.properties
file.
If you're using it, you might need to set <property name="show_sql">false</property>
in your hibernate configuration file.
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