log4j控制台打印sql

This commit is contained in:
zxm 2018-03-05 17:52:11 +08:00
parent e9c55cecfc
commit 100cb363ce
2 changed files with 32 additions and 5 deletions

View File

@ -3,9 +3,6 @@ server:
security:
basic:
enabled: false
logging:
level: debug
spring:
datasource:
# url: jdbc:mysql://www.cqwzxt.com:3306/lenos?useUnicode=true&characterEncoding=UTF-8
@ -13,7 +10,7 @@ spring:
# password: lenos
url: jdbc:mysql://localhost:3306/lenos?useUnicode=true&characterEncoding=UTF-8
username: root
password:
password: 123456
# 使用druid数据源
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
@ -35,7 +32,6 @@ spring:
force: true
mybatis:
type-aliases-package: com.len.entity
mapper-locations: classpath*:mapper/*.xml
@ -54,6 +50,9 @@ pagehelper:
reasonable: true
supportMethodsArguments: true
params: count=countSql
logging:
level:
com.len.mapper: debug
#security:
# basic:
# enabled: false

View File

@ -0,0 +1,28 @@
#logger level
log4j.rootCategory=DEBUG,stdout,DebugAppender,InfoAppender,ErrorAppender
log4j.debug=true
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[QC] %p [%t] %C.%M(%L) | %m%n
#logger input file
log4j.logger.DebugAppender.access=DEBUG
log4j.appender.DebugAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DebugAppender.File=../logs/debug.log
log4j.appender.DebugAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.DebugAppender.layout.ConversionPattern=%d-[TS] %p %t %c - %m%n
#logger input file
log4j.logger.InfoAppender.access=INFO
log4j.appender.InfoAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.InfoAppender.File=../logs/INFO.log
log4j.appender.InfoAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.InfoAppender.layout.ConversionPattern=%d-[TS] %p %t %c - %m%n
#error log input file
log4j.logger.ErrorAppender.access=ERROR
log4j.appender.ErrorAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ErrorAppender.File=../logs/ERROR.log
log4j.appender.ErrorAppender.Append = true
log4j.appender.ErrorAppender.threshold = ERROR
log4j.appender.ErrorAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ErrorAppender.layout.ConversionPattern=%d{MM-dd HH:mm:ss.SSS} %c %-5p - %m%n