How do I get hibernate 4 to log via logback? I have a war deployed to wildfly 8 final, and I am using slf4j with logback. The logging setup is working 100% in the application with both the console appender and file appender working as intended.
Here is what I did to get slf4j + logback working:
Excluded the logging subsystem with jboss-deployment-structure.xml in WEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="logging" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
Included slf4j and logback dependencies in pom:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
</dependency>
Logging in app with org.slf4j.Logger
Added 3 loggers to logback.xml:
<logger name="my.package" level="TRACE"/>
<logger name="org.hibernate.type" level="ALL" />
<logger name="org.hibernate" level="TRACE" />
I don't see anything hibernate related in the logs.
The only time I see anything from hibernate is when I add to my persistence.xml:
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
</properties>
But it logs to the server log and console and not to my logback appenders even if my root logger is set to trace . . .
The logback ViewStatusMessagesServlet looks healthy and shows the hibernate loggers registered: 2014-02-23 19:02:37 INFO LoggerAction Setting level of logger [org.hibernate.type] to ALL
2014-02-23 19:02:37 INFO LoggerAction Setting level of logger [org.hibernate] to TRACE
I can also get the prepared statement logged with hibernate.ejb.interceptor registered in persistence.xml. This also does not provide any method to get the query params unfortunately
Can anyone help me out?