ibatis配置log4j输出sql语句等日志信息
建立一个log4j.properties文件,放到工程源文件夹下,如果是eclipse那么放到src下,eclipse会自动将这个文件加载到class目录下。
- 如果是JB,那么要设置,这类型的文件也加载到目标项目中。
- 将log4j.jar和commons-logging.jar(我这次就是落下了这个jar,日了!)放到项目的类路径中,如果是web项目就是lib下。
- 配置的log4j.properties文件的例子。证明可用!
- #--------------------------------
- #
- log4j.rootLogger=DEBUG, stdout, fileout
- #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
- #--------------------------------
相关推荐
大唐帝国前营 2020-08-18
MrLiar 2020-07-07
丨Fanny丨Cri 2020-06-13
chw0 2020-11-04
sdaq 2020-07-26
sdaq 2020-06-16
CXC0 2020-06-14
CXC0 2020-06-08
dongxurr 2020-06-07
sdaq 2020-06-06
MrLiar 2020-06-04
丨Fanny丨Cri 2020-06-03
MrLiar 2020-05-25
丨Fanny丨Cri 2020-05-17
MrLiar 2020-05-14
MrLiar 2020-05-12
sdaq 2020-05-11