javaspringhibernatelog4j

Turn off hibernate logging to console


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?


Solution

  • 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.