# Root logger option
log4j.rootLogger=DEBUG, file, stdout
# Daily rolling file appender
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=logs/jdbc.log
log4j.appender.file.Append=true
log4j.appender.file.DatePattern='.'dd-MM-yyyy
log4j.appender.file.encoding=UTF-8
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd-MM-yyyy HH:mm:ss} %-5p %c{1}:%L - %m%n
#log4j.appender.file.layout.ConversionPattern=%p %t %c - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n`
#log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%p %t %c - %m%n
# Spring JDBC logging
log4j.logger.org.springframework.jdbc=DEBUG
log4j.logger.org.springframework.jdbc.core.JdbcTemplate=DEBUG, file
log4j.logger.org.springframework.jdbc.core.StatementCreatorUtils=TRACE, file
# Spring Transaction logging
log4j.logger.org.springframework.transaction=INFO
log4j.logger.org.springframework.transaction.interceptor=TRACE
#log4j.logger.org.springframework.jdbc.datasource.DataSourceTransactionManager=DEBUG
#log4j.logger.org.springframework.orm.jpa=INFO
# Hibernate Transaction logging
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.engine.transaction=DEBUG
log4j.logger.org.springframework.orm.hibernate3.HibernateTransactionManager=DEBUG
# BoneCP Connection Pooling logging
#log4j.category.com.jolbox=DEBUG,stdout
-------------------------------------------------------------------------------
Note: Spring JDBCTemplate is using common-logging API to log.
And if you are using log4j in your application, you will have to add
common logging bridge for the same. Add following in your pom.xml
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.0-rc1</version>
</dependency>
-------------------------------------------------------------------------------
Note: Logging Spring in IBM Websphere click -------------------------------------------------------------------------------
log4j.rootLogger=DEBUG, file, stdout
# Daily rolling file appender
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=logs/jdbc.log
log4j.appender.file.Append=true
log4j.appender.file.DatePattern='.'dd-MM-yyyy
log4j.appender.file.encoding=UTF-8
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd-MM-yyyy HH:mm:ss} %-5p %c{1}:%L - %m%n
#log4j.appender.file.layout.ConversionPattern=%p %t %c - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n`
#log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%p %t %c - %m%n
# Spring JDBC logging
log4j.logger.org.springframework.jdbc=DEBUG
log4j.logger.org.springframework.jdbc.core.JdbcTemplate=DEBUG, file
log4j.logger.org.springframework.jdbc.core.StatementCreatorUtils=TRACE, file
# Spring Transaction logging
log4j.logger.org.springframework.transaction=INFO
log4j.logger.org.springframework.transaction.interceptor=TRACE
#log4j.logger.org.springframework.jdbc.datasource.DataSourceTransactionManager=DEBUG
#log4j.logger.org.springframework.orm.jpa=INFO
# Hibernate Transaction logging
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.engine.transaction=DEBUG
log4j.logger.org.springframework.orm.hibernate3.HibernateTransactionManager=DEBUG
# BoneCP Connection Pooling logging
#log4j.category.com.jolbox=DEBUG,stdout
-------------------------------------------------------------------------------
Note: Spring JDBCTemplate is using common-logging API to log.
And if you are using log4j in your application, you will have to add
common logging bridge for the same. Add following in your pom.xml
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.0-rc1</version>
</dependency>
-------------------------------------------------------------------------------
Note: Logging Spring in IBM Websphere click -------------------------------------------------------------------------------