I have a web application deployed on tomcat that uses hibernate and spring. I am using logback as my logging api.
This is my logback.xml file which i have placed in classes folder (so wd be in web application classpath, and thus configured automatically)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="File" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>mylog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>mylog.%i.log.zip</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>5</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>5MB</MaxFileSize>
</triggeringPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{yyyy/MM/dd HH:mm:ss} [%thread] %-5p %c - %m%n</pattern>
</layout>
</appender>
<!-- Hibernate Loggers -->
<logger name="org.hibernate.type">
<level value="DEBUG" />
<appender-ref ref="File" />
</logger>
<logger name="org.hibernate.SQL">
<level value="DEBUG" />
<appender-ref ref="File" />
</logger>
<logger name="sql-log">
<level value="DEBUG" />
<appender-ref ref="File" />
</logger>
<logger name="package.to.hold.my.classes">
<level value="DEBUG" />
<appender-ref ref="File" />
</logger>
<root>
<level value="info" />
<appender-ref ref="File" />
</root>
</configuration>
The issue is although i can see debug and above level logs generated by classes with in
package.to.hold.my.classes.... I cant see any sql and parameter/return types being logged in the log file.
Here is the part of code from spring applicationContext file that configures sessionfactory
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
............
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SybaseDialect</prop>
<prop key="show_sql">false</prop>
</props>
</property>
</bean>
I have already tried settting show_sql to true and false but it did not work. Also tried both console and file appenders and neither worked.
Please let me know your views, any direction wd be highly appreciated.