Ibatis打印sql语句--log4j

所需jar包

log4j-1.2.11.jar

log4j配置文件

log4j.properties

Ibatis打印sql语句--log4j

# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!
# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.
log4j.rootLogger=INFO, stdout, logfile

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=mpsmodel.log
log4j.appender.logfile.MaxFileSize=512KB
# Keep three backup files.
log4j.appender.logfile.MaxBackupIndex=3
# Pattern to output: date priority [category] - message
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n


#log4j.category.org.apache.commons.dbcp=debug
#log4j.category.com.ibatis=debug
#log4j.category.org.springframework=debug

#kai write
log4j.logger.com.ibatis = DEBUG 
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource = DEBUG 
log4j.logger.com.ibatis.common.jdbc.ScriptRunner = DEBUG 
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate = DEBUG 
log4j.logger.java.sql.Connection = DEBUG 
log4j.logger.java.sql.Statement = DEBUG 
log4j.logger.java.sql.PreparedStatement = DEBUG, fileout 
log4j.logger.java.sql.ResultSet = DEBUG 

你可能感兴趣的:(ibatis)