OK, I need a little help switching on debug logging in Hibernate running under JBoss.
I thought I would be able to switch it on by adding an appender and some categories to my log4j.xml file in JBoss. Here's what I added:
Code:
<!-- ======================= -->
<!-- Hibernate -->
<!-- ======================= -->
<appender name="HIBERNATE" class="org.jboss.logging.appender.DailyRollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="${jboss.server.log.dir}/hibernate.log"/>
<param name="Append" value="false"/>
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<!-- Rollover at the top of each hour
<param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
-->
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
<!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
<category name="org.hibernate">
<priority value="DEBUG" />
<appender-ref ref="HIBERNATE"/>
</category>
<category name="org.hibernate.SQL">
<priority value="DEBUG" />
<appender-ref ref="HIBERNATE"/>
</category>
<category name="org.hibernate.type">
<priority value="DEBUG" />
<appender-ref ref="HIBERNATE"/>
</category>
I expected to see debug messages streaming to my hibernate.log file, but no such luck. In fact I get nothing at all.
This seems overly complex, is there a simple way of getting the debug messages out of Hibernate?