zoukankan      html  css  js  c++  java
  • 配置日志

    logback.xml

    <?xml version="1.0" encoding="UTF-8"?>
    
    <configuration>
        <property name="log.base"
            value="D:/logs/log_info" />
        <property name="log.error"
            value="D:/logs/log_error" />
        
        <jmxConfigurator />
    
        <appender name="logfile"
            class="ch.qos.logback.core.rolling.RollingFileAppender">
            
            <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                <thresholdFevel>INFO</thresholdFevel>
            </filter>
            <!-- 文件路径 -->
            <File>${log.base}.log</File>
    
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <!-- 文件名称 -->
                <fileNamePattern>${log.base}.%d{yyyy-MM-dd}.log.%i</fileNamePattern>
    
                <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                    <maxFileSize>200MB</maxFileSize>
                </timeBasedFileNamingAndTriggeringPolicy>
                
                <!-- 最大保存十天的日志 -->
                <maxHistory>10</maxHistory>
            </rollingPolicy>
    
            <encoder>
                <pattern>%date [%thread] %-5level %logger{80} - %msg%n</pattern>
                <charset>UTF-8</charset>
            </encoder>
    
        </appender>
    
        <appender name="logfilerror"
            class="ch.qos.logback.core.rolling.RollingFileAppender">
    
            <filter class="ch.qos.logback.classic.filter.LevelFilter">
                <thresholdFevel>ERROR</thresholdFevel>
                <onMismatch>DENY</onMismatch>
                <onMatch>ACCEPT</onMatch>
            </filter>
    
            <File>${log.error}.log</File>
    
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${log.error}.%d{yyyy-MM-dd}.log.%i</fileNamePattern>
                <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                    <maxFileSize>200MB</maxFileSize>
                </timeBasedFileNamingAndTriggeringPolicy>
                <maxHistory>10</maxHistory>
            </rollingPolicy>
    
            <encoder>
                <pattern>%date [%thread] %-5level %logger{80} - %msg%n</pattern>
                <charset>UTF-8</charset>
            </encoder>
    
        </appender>
    
        <logger name="baoming" level="INFO" />
    
        <root>
            <level value="INFO" />
            <appender-ref ref="logfile" />
            <appender-ref ref="logfilerror" />
        </root>
    
    </configuration>
  • 相关阅读:
    Django之 Choices参数、MVC和MTV模型、Ajax
    Django之聚合查询、分组查询、查询优化以及F、Q查询
    Django 之 模型层ORM操作
    Django关于视图层和模板层相关操作
    Django数据操作、ORM表设计、路由层
    Django三板斧,Django连接数据库
    前端--jQuery
    前端----BOM和DOM
    .zip.001 -- .zip.003解压缩
    HTTP Status Codes
  • 原文地址:https://www.cnblogs.com/BonnieWss/p/8968918.html
Copyright © 2011-2022 走看看