Turning off hibernate logging console output
Executing:
java.util.logging.Logger.getLogger("org.hibernate").setLevel(Level.OFF);
before hibernate's initialization worked for me.
Note: the line above will turn every logging off (Level.OFF
). If you want to be less strict, you can use
java.util.logging.Logger.getLogger("org.hibernate").setLevel(Level.SEVERE);
that is silent enough. (Or check the java.util.logging.Level
class for more levels).
You can disabled the many of the outputs of hibernate setting this props of hibernate (hb configuration) a false:
hibernate.show_sql
hibernate.generate_statistics
hibernate.use_sql_comments
But if you want to disable all console info you must to set the logger level a NONE of FATAL of class org.hibernate
like Juha say.
Try to set more reasonable logging level. Setting logging level to info
means that only log event at info
or higher level (warn
, error
and fatal
) are logged, that is debug
logging events are ignored.
log4j.logger.org.hibernate=info
or in XML version of log4j config file:
<logger name="org.hibernate">
<level value="info"/>
</logger>
See also log4j manual.
Important notice: the property (part of hibernate configuration, NOT part of logging framework config!)
hibernate.show_sql
controls the logging directly to STDOUT bypassing any logging framework (which you can recognize by the missing output formatting of the messages). If you use a logging framework like log4j, you should always set that property to false because it gives you no benefit at all.
That circumstance irritated me quite a long time because I never really cared about it until I tried to write some benchmark regarding Hibernate.