views:

436

answers:

3

I've already set

<property name="show_sql">false</property>

& disable all messages in log4j.properties

But Hibernate shit to console with all queries & statements.

A: 

You adding something like this to log4j.properties?

log4j.logger.org.hibernate = WARN
Droo
+4  A: 

Setting the hibernate.show_sql to true tells hibernate to Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL to debug.

So even if you set this property to false, make sure that you don't have the following category defined (or configured to use a console appender):

log4j.logger.org.hibernate.SQL=DEBUG

Also, make sure that you don't set the hibernate.show_sql programmatically to true when instancing your Configuration object. Hunt something like this:

Configuration cfg = new Configuration().configure().
    .setProperty("hibernate.show_sql", "true");

Note that the setProperty(String propertyName, String value) takes as first parameter the full name of a configuration property i.e. hibernate.show_sql, not just show_sql.

Pascal Thivent
@Pascal: see my comment to the question. Everything you've suggested, I've looked into. Do you have any other ideas?
Tauren
A: 

It seems very strange, but when Use Eclipse with JUnit Test task, all output still goes to Console (in Eclipse Console window).

But when I use ant command for unit testing, nothing goes to console.

blackliteon