As sad in the title i want to stop Hibernate console output, without using log4j. I have tried to use log4j but i havent got anywhere. What i want is the console INFO outputs to stop. And if i am using log4j is it possible to do it without .properties or .xml files, just set the settings in the source. tnx
You can try this:
Logger log = Logger.getLogger("org.hibernate");
log.setLevel(Level.WARNING);
It should work. Just call it before you open any sessions.
Solution looks like adding slf4j-log4j12-1.5.2.jar in your classpath if you are using slf4j-api. This is other than configuration added for log4j for disabling logs.
This link should be useful.
http://ayushsuman.blogspot.com/2010/07/turning-off-hibernate-logging-console.html
You can also check other solutions from :
I can certify that Hibernate won't log on the console unless your configuration somehow allows it to do so. So, what version of Hibernate are you using? What SLF4J binding are you using if you're not using LOG4J as logging backend? Do you have a configuration file for it?
Or maybe did you turn on the echoing of SQL to stdout in your hibernate.cfg.xml
?:
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
You need to help readers a bit, we don't all have crystal balls :) Please provide more material.
Update: It appears that the OP had the slf4-simple
binding on his class path which is precisely used to output INFO
log messages to the console:
Binding for
Simple
implementation, which outputs all events toSystem.err
. Only messages of level INFO and higher are printed. This binding may be useful in the context of small applications.
Replacing slf4-simple
with another binding (you should not have multiple bindings on the class path) with the appropriate configuration should silence Hibernate.