When running my Spring/Hibernate application I see the following unwanted output on the console:
Hibernate: select securityus0_.ID ....
Hibernate: select securityus0_.ID ....
Hibernate: select securityus0_.ID ....
Hibernate: select securityus0_.ID ....
I have configured my Log4j logger like so:
<logger name="org.hibernate">
<level value="FATAL"/>
</logger>
<category name="STDOUT">
<priority value="WARN"/>
</category>
<category name="STDERR">
<priority value="WARN"/>
</category>
<!-- for all other loggers log only info and above log messages -->
<root>
<priority value="WARN"/>
<appender-ref ref="STDOUT" />
</root>
How do I silence these messages?
The better way to activate the logging of executed SQL statements is to set the log level of the org. hibernate. SQL category to DEBUG (or the corresponding log level of your log framework).
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.
I'm fairly certain that you're seeing those SQL statements because somewhere in your Hibernate config the property "hibernate.show_sql" is set to true. Find that setting and change to false.
If you have a persistence.xml file try there. That's where I found it.
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