MyBatisPlus多数据源日志打印问题

logging:
level:
com.***.***.mapper: debug

# 方式一
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

# 方式二 application.yml 中增加配置,指定 mapper 文件所在的包
logging:
level:
com.baomidou.example.mapper: debug

多数据源打印推荐使用第二种



多数据源时,配置 mybatis-plus 日志不生效问题。

org.apache.ibatis.logging.stdout.StdOutImpl 可以打印控制台日志,如果要输出 DAO 类的 debug 级别的日志,可以配置:

logging:
level:
com.xx.xx.*.dao: debug

生产环境下,需要配置成另一个类:

mybatis-plus:
configuration:
# 开启驼峰命名规则自动转换
map-underscore-to-camel-case: true
# 日志打印
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl

posted @ 2022-10-27 11:40  全琪俊  阅读(832)  评论(0编辑  收藏  举报