I'm trying simply to get the values that Hibernate is binding to the queries behind the question marks "?" on JBoss 7.
So I'm editing standalone/configuration/logging.properties in order to add this :
logger.org.hibernate=DEBUG
logger.org.hibernate.type=ALL
But I get nothing in my console, nor in the log file... what am I missing ?
Wow, it's not really like the previous versions... I've finally found the offical way to configure JBoss 7 logging and the logging configuration of Hibernate 4 !
What you have to do is edit standalone/configuration/standalone.xml (the configuration file of your domain) and search for the <subsystem xmlns="urn:jboss:domain:logging:1.1"> tag.
Then in the <console-handler name="CONSOLE", I've switched the level information to TRACE (<level name="TRACE") and added the <logger category="org.hibernate">.
Here is the partial XML :
<subsystem xmlns="urn:jboss:domain:logging:1.1">
    <console-handler name="CONSOLE" autoflush="true">
        <level name="TRACE"/>
        <formatter>
            <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
        </formatter>
    </console-handler>
    ...
    <logger category="org.hibernate.type.descriptor.sql.BasicBinder">
        <level name="TRACE"/>
    </logger>
    ...
I've found another and better (because it logs all the JDBC method calls, not only basic binding) solution from a blog post: add spy="true" in the <datasource> declaration and TRACE logs from category jboss.jdbc.spy:
<datasource jta="true" jndi-name="java:jboss/datasources/myDS" pool-name="myPool" enabled="true" use-java-context="true" spy="true" use-ccm="true">
and the logger (in <subsystem xmlns="urn:jboss:domain:logging:1.1">):
<logger category="jboss.jdbc.spy">
    <level name="TRACE"/>
</logger>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With