I am using hibernate 3.2.5.ga and having sever difficult setting up log4j logging. I have tried everything in this thread: Configuring Hibernate logging using Log4j XML config file?
In summary: here is my log4j.xml
in my hibernate.properties I have
<appender name="HibernateAppender" class="org.apache.log4j.FileAppender">
<param name="File" value="hibernate.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%t] [Acc=%X{MDCKey.Account}] [Oppo=%X{MDCKey.Opportunity}] [URL=%X{MDCKey.Url}] [Dest=%X{MDCKey.Dest}] (%F:%L) - %m%n"/>
</layout>
</appender>
<logger name="org.hibernate">
<level value="debug" />
<appender-ref ref="HibernateAppender"/>
</logger>
<root>
<priority value="info" />
<appender-ref ref="Log"/>
<appender-ref ref="DailyRollover"/>
<appender-ref ref="ErrorCaptureAppender"/>
</root>
In my hibernate.properties I also set:
hibernate.show_sql true
When I debug the code, I see hibernate delegate its logging to slf4j classes. When I debug these classes I see empty implementation of methods. For example: org.slf4j.impl.NOPLogger has empty implementation for its log methods. I think this the problem.
In my maven I have :
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.2</version>
<optional>false</optional>
</dependency>
So this is the version of slf4j I am using. Note, I have tried various configurations for the log4j.xml for example explictly adding the appender to the root. Just really stuck.
Any tips?