0

My output contains a lot of rows as Hibernate: select salary0_.id as id1_15_19_, salary0_.balance as balance2_15_19_, salary0_.bonus as bonus3_15_19_.....

How to exclude them? My log4j.xml is:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true"
                 xmlns:log4j='http://jakarta.apache.org/log4j/'>

<appender name="console" class="org.apache.log4j.ConsoleAppender">
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern"
               value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
    </layout>
</appender>

<root>
    <level value="INFO" />
    <appender-ref ref="console" />
</root>

</log4j:configuration>

1 Answer 1

4

It is not related to your log4j configuration, but to Hibernate configuration. Somewhere you should have a property "showsql" set to true.

E.g. if you use e.g. Spring and a root-context.xml file you could have something like

    <property name="jpaVendorAdapter">
        <bean
            class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
            <property name="showSql" value="true" />
           <!-- [snip] -->
        </bean>
    </property>

Alternatively, on hibernate.xml you can add:

<property name="show_sql">false</property>
Sign up to request clarification or add additional context in comments.

1 Comment

It can be in hibernate.properties too. The full name of the property hibernate.show_sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.