*MyBatis框架 在控制台打印sql语句

以 log4j.properties 
中以立刻段代码添加进去就吓了

#
log4j.rootLogger=INFO,
Console

#Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d
[%t] %-5p [%c] – %m%n

log4j.logger.java.sql.ResultSet=DEBUG
log4j.logger.org.apache=ERROR
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG

#####就算端这等同点内容,下面是本身的某部项目遭到 log4j.properties 
的源码

# Set root category priority to INFO and its only appender to
CONSOLE.
log4j.rootCategory=DEBUG,CONSOLE,LOGFILE,LOGERROR
#log4j.rootCategory=INFO, CONSOLE, LOGFILE

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
#log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout.ConversionPattern=%-d{yyyy-MM-dd
HH\:mm\:ss} [%c]-[%p] %m%n
log4j.appender.CONSOLE.Encoding=UTF-8

#
log4j.rootLogger=INFO, Console
#Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] –
%m%n
log4j.logger.java.sql.ResultSet=DEBUG
log4j.logger.org.apache=ERROR
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
#

# LOGFILE is set to be a File appender using a PatternLayout.
# log4j.appender.LOGFILE=org.apache.log4j.DailyRollingFileAppender
# log4j.appender.LOGFILE.DatePattern=’.’yyyy-MM-dd
# log4j.appender.LOGFILE.File=${catalina.base}/logs/APPLog.log
# log4j.appender.LOGFILE.Threshold=INFO
# log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
# log4j.appender.LOGFILE.layout.ConversionPattern=%-d{yyyy-MM-dd
HH\:mm\:ss} [%c]-[%p] %m%n
 
log4j.appender.LOGFILE=org.apache.log4j.DailyRollingFileAppender
#\uFF08\u5B89\u88C5\u76EE\u5F55\uFF09\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1
log4j.appender.LOGFILE.File=${catalina.base}/logs/info.log
log4j.appender.LOGFILE.DatePattern=’.’yyyy-MM-dd
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.Threshold=INFO
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%-d{yyyy-MM-dd
HH\:mm\:ss.SSS} [%c]-[%p] %m%n
log4j.appender.LOGFILE.Encoding=UTF-8

log4j.appender.LOGERROR=org.apache.log4j.DailyRollingFileAppender
log4j.appender.LOGERROR.File=${catalina.base}/logs/error.log
log4j.appender.LOGERROR.DatePattern=’.’yyyy-MM-dd
log4j.appender.LOGERROR.Append=true
log4j.appender.LOGERROR.Threshold=ERROR
log4j.appender.LOGERROR.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGERROR.layout.ConversionPattern=%-d{yyyy-MM-dd
HH\:mm\:ss.SSS} [%c]-[%p] %m%n
log4j.appender.LOGERROR.Encoding=UTF-8
# Set the enterprise logger category to FATAL and its only appender to
CONSOLE.
#log4j.logger.com.qualcomm=DEBUG
log4j.logger.org.acegi=ERROR
log4j.logger.com.svw.tms=DEBUG
log4j.logger.org.springframework=ERROR
log4j.logger.org.mybatis=ERROR
log4j.logger.org.quartz=INFO
log4j.logger.com.broadtext=DEBUG
log4j.logger.com.svw.common.workbench=DEBUG
log4j.logger.com.opensymphony=ERROR
log4j.logger.com.mchange=ERROR
log4j.logger.freemarker=ERROR
log4j.logger.net.sf.ehcache=ERROR

#log4j.logger.org.hibernate.type=DEBUG

 

网站地图xml地图