• logback配置


    1.maven配置pom.xml:

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependenc

    2.在resource目录添加logback.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
            </encoder>
        </appender>
        <appender name="info" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${catalina.base}/logs/systemInfo.log</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${catalina.base}/logs/systemInfo-%d{yyyy-MM-dd}.log</fileNamePattern>
                <maxHistory>15</maxHistory>
            </rollingPolicy>
            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                <pattern>%-5p [%d][%mdc{mdc_userId}] %C:%L - %m %n</pattern>
                <charset>utf-8</charset>
            </encoder>
            <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                <level>INFO</level>
            </filter>
        </appender>
        
        <root level="INFO">
            <appender-ref ref="info" />
        </root>
    </configuration>
  • 相关阅读:
    docker的应用部署
    docker容器的数据卷
    找到最终的安全状态 深搜
    park和unpark方法详解
    docker容器相关命令
    docker鏡像相關命令
    join方法底层实现
    Elasticsearch启动过程错误汇总
    MySQL 8.0.12 报错The table does not comply with the requirements by an external plugin. (errno 3098)
    docker login 密码查看和加密保存
  • 原文地址:https://www.cnblogs.com/ctsx/p/9989408.html
Copyright © 2020-2023  润新知