1、SpringBoot使用logback输出日志并打印sql信息
Springboot中只需要在application.yml配置文件中加上
logImpl: org.apache.ibatis.logging.stdout.StdOutImpl
完整的配置文件
mybatis:
configuration:
mapUnderscoreToCamelCase: true
logImpl: org.apache.ibatis.logging.stdout.StdOutImpl
typeAliasesPackage: com.jsptpd.gayg.modules
mapperLocations: classpath:com/jsptpd/gayg/**/*.xml
spring:
resource:
static-locations: file:/public/
http:
multipart:
max-file-size: 20Mb
max-request-size: 80Mb
profiles:
active: dev
Debug模式下有断点会进入断点,想要查看控制台的sql语句需要切换Debugger/Console
2、如果是Spring 4.0.2 + Spring MVC 4.0.2 + MyBatis 3.2.6架构
MyBatis3 用log4j在控制台输出 SQL
mybatis配置log4j控制台打印SQL语句
spring boot 整合 log4j 控制台打印sql(mybatis)
网友评论