• slf4j与mybatis结合显示sql


    需要引入的依赖包

    <!-- LOGGING begin -->
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>${slf4j.version}</version>
    </dependency>
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>${slf4j.version}</version>
    </dependency>
    <!-- common-logging 实际调用slf4j -->
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>${slf4j.version}</version>
    </dependency>
    <!-- java.util.logging 实际调用slf4j -->
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jul-to-slf4j</artifactId>
    <version>${slf4j.version}</version>
    </dependency>
    <!-- LOGGING end -->

    log4j.properties中如下配置

    # Output pattern : date [thread] priority category - message FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7
    log4j.rootLogger=WARN, Console, RollingFile

    #Console
    log4j.appender.Console=org.apache.log4j.ConsoleAppender
    log4j.appender.Console.layout=org.apache.log4j.PatternLayout
    log4j.appender.Console.layout.ConversionPattern=%d %-5p [%c{5}] - %m%n

    #RollingFile
    log4j.appender.RollingFile=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.RollingFile.File=logs.log
    log4j.appender.RollingFile.layout=org.apache.log4j.PatternLayout
    log4j.appender.RollingFile.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n

    log4j.logger.java.sql=DEBUG

  • 相关阅读:
    bzoj 3262: 陌上花开
    hdu 5618 Jam's problem again
    bzoj 1176: [Balkan2007]Mokia
    bzoj 2683: 简单题
    Codevs 1080 线段树练习(CDQ分治)
    bzoj 3223: Tyvj 1729 文艺平衡树
    bzoj 1503: [NOI2004]郁闷的出纳员
    bzoj 1208: [HNOI2004]宠物收养所
    bzoj 1588: [HNOI2002]营业额统计
    bzoj 3224: Tyvj 1728 普通平衡树
  • 原文地址:https://www.cnblogs.com/timothy316/p/4588932.html
Copyright © 2020-2023  润新知