MyBatis配置log4j输出日志
# This is the configuring for logging displayed in the Application Server;delete ,stdout
log4j.rootCategory=INFO,stdout,R
# Replace the line above if you want to put a log file into the directory
# you start Tomcat from
# log4j.rootCategory=INFO, stdout, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=[你的日志文件名]%d{ISO8601}- %p [%t] %c{1}.%M(%L) | %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
# You can change this to be an absolute path or even an environment variable
# If you're using an environment variable, you will have to set JAVA_OPTS
# to contain this variables - for example in the catalina.sh or catalina.bat
# file
log4j.appender.R.File=${webapp.root}/logs/日志文件名.log
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.R.MaxFileSize=500KB
# Don't keep a backup file
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
#log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %p %t [%C{1}] - %m%n
log4j.appender.R.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.logger.com.opensymphony.xwork2.util.OgnlUtil=error
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack=error
log4j.logger.org.springframework.beans.factory.xml.XmlBeanDefinitionReader=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.mapper包的路径,如com.iccc.mapper=DEBUG,CONSOLE
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet =DEBUG
在MyEclipse控制台就可以打印出sql及参数信息,亲测成功!
上一篇: struts2嵌套list属性,接收页面传递过来的参数
下一篇: spring mvc 2
推荐阅读
-
基于web项目log日志指定输出文件位置配置方法
-
使用Log4j为项目配置日志输出应用详解以及示例演示的实现分析
-
idea mybatis配置log4j打印sql语句的示例
-
MyBatis3用log4j在控制台输出SQL的方法示例
-
Java学习笔记 DbUtils数据库查询和log4j日志输出 使用
-
基于web项目log日志指定输出文件位置配置方法
-
idea mybatis配置log4j打印sql语句的示例
-
Java学习笔记 DbUtils数据库查询和log4j日志输出 使用
-
MyBatis学习总结(二)——MyBatis核心配置文件与输入输出映射
-
Docker 生产环境之日志 - 配置日志驱动程序的输出