SpringBoot + MyBatisSQL输出配置

指定MyBatis的日志实现为Slf4Japplication.yml文件
mybatis:
type-aliases-package: com.contract.housekeeper.dao.entity
mapper-locations: classpath*:com/contract/housekeeper/dao/mapping/*.xml
configuration:
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
log-impl属性种指定了Slf4j的日志实现

配置Mapper包输出级别为DEBUGapplication.yml文件
logging:
level:
root: INFO
com.exmple.mapper: DEBUG
file: “D:/demo.log”
# config: classpath:logback-spring.xml
root或mapper包指定为DEBUG

Tips:MyBatis的logImpl可选值有:
Log4j2LoggerImpl (org.apache.ibatis.logging.log4j2)
StdOutImpl (org.apache.ibatis.logging.stdout)
Jdk14LoggingImpl (org.apache.ibatis.logging.jdk14)
Slf4jImpl (org.apache.ibatis.logging.slf4j)
Slf4jLocationAwareLoggerImpl (org.apache.ibatis.logging.slf4j)
NoLoggingImpl (org.apache.ibatis.logging.nologging)
Slf4jLoggerImpl (org.apache.ibatis.logging.slf4j)
JakartaCommonsLoggingImpl (org.apache.ibatis.logging.commons)
Log4jImpl (org.apache.ibatis.logging.log4j)
Log4j2Impl (org.apache.ibatis.logging.log4j2)
Log4j2AbstractLoggerImpl (org.apache.ibatis.logging.log4j2)

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理