• Logback配置讲解


    复制文件并粘贴到项目下:

    logback.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration scan="true" scanPeriod="60 seconds" debug="false">
        <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
            <encoding>UTF-8</encoding>
            <encoder>
                <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
            </encoder>
            <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                <level>DEBUG</level>
            </filter>
        </appender>
    
        <appender name="mmall" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <File>d:/mmalllog/mmall.log</File>
            <!--<File>/developer/apache-tomcat-7.0.73/logs/mmall.log</File>-->
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>d:/mmalllog/mmall.log/mmall.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
                <append>true</append>
                <maxHistory>10</maxHistory>
            </rollingPolicy>
            <encoder>
                <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
            </encoder>
        </appender>
    
    
        <appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <File>d:/mmalllog/mmall.log</File>
            <!--<File>/developer/apache-tomcat-7.0.73/logs/error.log</File>-->
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <!--<fileNamePattern>/devsoft/apache-tomcat-7.0.73/logs/error.log.%d{yyyy-MM-dd}.gz</fileNamePattern>-->
                <fileNamePattern>d:/mmalllog/mmall.log/mmall.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
                <append>true</append>
                <maxHistory>10</maxHistory>
            </rollingPolicy>
            <encoder>
                <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
            </encoder>
            <filter class="ch.qos.logback.classic.filter.LevelFilter">
                <level>ERROR</level>
                <onMatch>ACCEPT</onMatch>
                <onMismatch>DENY</onMismatch>
            </filter>
        </appender>
    
        <logger name="com.mmall" additivity="false" level="INFO" >
            <appender-ref ref="mmall" />
            <appender-ref ref="console"/>
        </logger>
    
    
    
        <!-- geelynote mybatis log 日志 -->
    
        <logger name="com.mmall.dao" level="DEBUG"/>
    
        <!--<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG" >-->
            <!--<appender-ref ref="console"/>-->
        <!--</logger>-->
    
        <!--<logger name="java.sql.Connection" level="DEBUG">-->
            <!--<appender-ref ref="console"/>-->
        <!--</logger>-->
        <!--<logger name="java.sql.Statement" level="DEBUG">-->
            <!--<appender-ref ref="console"/>-->
        <!--</logger>-->
    
        <!--<logger name="java.sql.PreparedStatement" level="DEBUG">-->
            <!--<appender-ref ref="console"/>-->
        <!--</logger>-->
    
    
        <root level="DEBUG">
            <appender-ref ref="console"/>
            <appender-ref ref="error"/>
        </root>
    
    </configuration>
  • 相关阅读:
    Linux 下的类似Windows下Everything的搜索工具
    windows和linux环境下制作U盘启动盘
    程序调试手段之gdb, vxworks shell
    LeetCode 1021. Remove Outermost Parentheses (删除最外层的括号)
    LeetCode 1047. Remove All Adjacent Duplicates In String (删除字符串中的所有相邻重复项)
    LeetCode 844. Backspace String Compare (比较含退格的字符串)
    LeetCode 860. Lemonade Change (柠檬水找零)
    LeetCode 1221. Split a String in Balanced Strings (分割平衡字符串)
    LeetCode 1046. Last Stone Weight (最后一块石头的重量 )
    LeetCode 746. Min Cost Climbing Stairs (使用最小花费爬楼梯)
  • 原文地址:https://www.cnblogs.com/XJJD/p/8193916.html
Copyright © 2020-2023  润新知