Ibatis log4j设置

#-------------------------------- 
#
log4j.rootLogger=DEBUG, stdout
#log4j.logger.test=info
#log4j.logger.org.apache.jasper = DEBUG
#log4j.logger.org.apache.catalina.startup.TldConfig = DEBUG
#log4j.logger.org.apache.catalina.session.ManagerBase = DEBUG

log4j.logger.com.fiscal = DEBUG
log4j.logger.com.system = DEBUG

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
log4j.logger.java.sql.ResultSet = DEBUG

log4j.appender.stdout=org.apache.log4j.ConsoleAppender 

#log4j.appender.fileout=org.apache.log4j.RollingFileAppender
#log4j.appender.fileout.File=C:\\ibatis.log 
#log4j.appender.fileout.MaxFileSize=10000KB 

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 
#log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH\:mm\:ss} \:%m%n 
#log4j.appender.fileout.layout=org.apache.log4j.PatternLayout 
#log4j.appender.fileout.layout.ConversionPattern=[%-5p]_%d{yyyy-MM-dd HH:mm:ss} :%m%n

#log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout 

# log4j.logger.org=info
#--------------------------------

 log4j.properties文件  内容如上 

 一定要把该文件放在src目录下面

然后导入log4j.jar和common-logging.jar这两个JAR包  设置OK后  在控制台上就能看到执行的SQL和相关日志信息

相关推荐