zoukankan      html  css  js  c++  java
  • springboot logback

    /resources/logback-spring.xml

    <configuration>
    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
    <Pattern>
    %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
    </Pattern>
    </layout>
    </appender>
    <appender name="D" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>D:/web/logs/log.log</file>
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
    <Pattern>
    %d{yyyy-MM-dd HH:mm:ss} - %msg%n
    </Pattern>
    </encoder>

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <!-- rollover daily -->
    <fileNamePattern>D:/web/logs/log%d{yyyy-MM-dd}.%i.log
    </fileNamePattern>
    <timeBasedFileNamingAndTriggeringPolicy
    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    <maxFileSize>10MB</maxFileSize>
    </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
    </appender>
    <appender name="E" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>D:/web/logs/error.log</file>
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
    <level>ERROR</level>
    </filter>
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
    <Pattern>
    %d{yyyy-MM-dd HH:mm:ss} - %msg%n
    </Pattern>
    </encoder>

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <!-- rollover daily -->
    <fileNamePattern>D:/web/logs/error%d{yyyy-MM-dd}.%i.log
    </fileNamePattern>
    <timeBasedFileNamingAndTriggeringPolicy
    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    <maxFileSize>10MB</maxFileSize>
    </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
    </appender>
    <root level="info">
    <appender-ref ref="stdout"/>
    <appender-ref ref="D"/>
    <appender-ref ref="E"/>
    </root>
    </configuration>
  • 相关阅读:
    kafka的使用
    linux卸载mysql
    kafka单机版的安装、集群部署 及使用
    winform改变启动界面
    C#连接sqlserver数据库
    叠加dgv中相同的行信息
    重定向和转发
    [Jenkins] 配置任务中的坑s
    【Android】冷门常用 ADB
    Linux 常用环境搭建
  • 原文地址:https://www.cnblogs.com/white-knight/p/9317183.html
Copyright © 2011-2022 走看看