zoukankan      html  css  js  c++  java
  • 08.MyBatis整合Log4j

    MyBatis整合Log4j:

    1.导入log4j.jar

    2.在conf.xml中开启日志文件:

    1 <!-- 配置日志文件 -->
    2     <settings>
    3         <setting name="logImpl" value="LOG4J"/>
    4     </settings>

    如果不指定,MyBatis就会根据一下顺序寻找日志:

    SLF4J -> Apache Commons Logging -> Log4j 2 -> Log4j -> jdk Logging

    3.编写配置日志输出文件:log4j.properties

    1 # Global logging configurationuff0cu5efau8baeu5f00u53d1u73afu5883u4e2du8981u7528debug
    2 log4j.rootLogger=DEBUG, stdout
    3 # Console output...
    4 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    5 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    6 log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

    日志级别:

        DEBUG<INFO<WARN<ERROR

    如果设置为info,则只显示info及以上级别的信息

    建议:在开发时设置debug,在运行时设置为info或以上

  • 相关阅读:
    C he 指针
    typedef 与 define
    (转)ubuntu中安装man手册查看函数原型
    .9 赫夫曼编码
    .8 AVL树
    PowerDesigner使用技巧
    C#基础
    NET框架设计
    Sql Server 执行计划及Sql查询优化
    SQL SERVER函数浅析
  • 原文地址:https://www.cnblogs.com/man-tou/p/11346953.html
Copyright © 2011-2022 走看看