美文网首页
mybatis日志输出级别设置

mybatis日志输出级别设置

作者: Geroge1226 | 来源:发表于2021-08-26 13:18 被阅读0次

1、说明

springboot 集成mybatis项目中,mybatis默认日志输出为debug级别。 打印日志如下,大量的语句参数信息,当在生产环境下,如果大量日志会导致排查问题困难(日志并发量大,交替严重)。这里我们设置日志级别。

[2021-08-26 11:22:07.296] [level: DEBUG] [Thread: http-nio-8081-exec-1] [ Class:com.myexp.mapper.SysAdminDepInfoMapper.selectByBelongDistrictCode >> Method: debug:159 ]
DEBUG:<==      Total: 1

[2021-08-26 11:22:07.301] [level: DEBUG] [Thread: http-nio-8081-exec-1] [ Class:com.myexp.mapper.MyexpIndexPageMapper.selectByExample >> Method: debug:159 ]
DEBUG:==>  Preparing: select id, version, district_id, brand_code, page_name, background_color, background_image, has_share_title, page_remarks, share_title,has_share_image, share_image, status, create_time, update_time, delete_time from myexp_index_page WHERE ( district_id = ? and brand_code = ? and status = ? )

[2021-08-26 11:22:07.302] [level: DEBUG] [Thread: http-nio-8081-exec-1] [ Class:com.myexp.mapper.MyexpIndexPageMapper.selectByExample >> Method: debug:159 ]
DEBUG:==> Parameters: MYEXP_DISTRICT_bcff121250e545f1abd7a440b4e30fca(String), yysports(String), 1(Integer)

[2021-08-26 11:22:07.304] [level: DEBUG] [Thread: http-nio-8081-exec-1] [ Class:com.myexp.mapper.MyexpIndexPageMapper.selectByExample >> Method: debug:159 ]
DEBUG:<==      Total: 1

[2021-08-26 11:22:07.305] [level: DEBUG] [Thread: http-nio-8081-exec-1] [ Class:com.myexp.mapper.MyexpIndexPageFloorMapper.selectByExampleWithBLOBs >> Method: debug:159 ]
DEBUG:==>  Preparing: select id, index_id, floor_type, sort, create_time, update_time , floor_details from myexp_index_page_floor WHERE ( index_id = ? )

[2021-08-26 11:22:07.306] [level: DEBUG] [Thread: http-nio-8081-exec-1] [ Class:com.myexp.mapper.MyexpIndexPageFloorMapper.selectByExampleWithBLOBs >> Method: debug:159 ]
DEBUG:==> Parameters: 55(Integer)

[2021-08-26 11:22:07.310] [level: DEBUG] [Thread: http-nio-8081-exec-1] [ Class:com.myexp.mapper.MyexpIndexPageFloorMapper.selectByExampleWithBLOBs >> Method: debug:159 ]
DEBUG:<==      Total: 8
 ...

2、mybatis设置日志级别

  • 方式一:改配置文件日志级别为info
    springboot整合mybatis可以通过配置文件修改级别,这里com.myexp.mapp.* 是mybatis mapper文件所在目录。
logging:
  level:
    com.myexp.mapper.*: info
  • 方式二:通过logback配置来设置输出级别
    当前springboot流行框架使用了logback作为日志工具。可设置
<logger name="com.myexp.mapper.*" level="DEBUG" additivity="false">

相关文章

  • mybatis日志输出级别设置

    1、说明 springboot 集成mybatis项目中,mybatis默认日志输出为debug级别。 打印日志如...

  • python logging 使用记录:设置INFO级别不生效,

    错误示范 没有输出INFO的日志级别。默认是WARN级别的日志,这里没有输出WARN说明没有设置成功。 设置一个h...

  • log4j2高级应用

    依赖配置 基本组件 Logger 日志记录器 如何输出日志,如指定输出方式、设置日志级别、设置日志过滤器等 App...

  • 酷派手机调试时无法输出日志问题

    手机在出厂时日志输出级别被设置为较高的级别,导致连接Android Studio调试时低等级的日志无法输出。需要进...

  • Mybatis-Plus的日志配置

    输出到控制台 关闭sql日志打印 logging.level设置日志级别:https://www.cnblogs....

  • GETH 日志模块的使用

    package log import "testing" //日志按级别输出 /** 可以按照日志级别输出日志==...

  • Go beego的logs源码解读

    beego的日志处理支持多种引擎、多种日志级别的输出,也可以设置输出方式(包括是否输出文件名和行号、同步输出或者异...

  • 4.springboot 与日志

    学习记录,仅供参考 异步输出 自动归档 日志级别: 所有支持的日志系统可以在springboot设置的记录器级别E...

  • appium自动化测试日志收集-logging

    关于日志级别: logging对象和filehandler都可以设置日志级别,logging设置的日志级别是控制台...

  • 环境变量使用

    比如启动容器时设置日志的输出级别: docker run --nameaspnetcore_sample --rm...

网友评论

      本文标题:mybatis日志输出级别设置

      本文链接:https://www.haomeiwen.com/subject/eeayiltx.html