Spring-boot项目logback规范

Spring-boot项目logback规范

博主: haitianisgood
原博客网址:
https://mp.csdn.net/mdeditor/79046632

spring-boot项目中日志管理规范:

  1. 日志输出到一个固定文件名,例如stdout.log
  2. 日志每天轮询一次 ,例如:stdout.log.20180112

<configuration debug="false">
    
    <property name="LOG_HOME" value="/data/log/service/jackie"/>
    
    <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%npattern>
            <charset>UTF-8charset>
        encoder>
    appender>
    
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            
            <FileNamePattern>${LOG_HOME}/%d{yyyyMMdd}.logFileNamePattern>
            
            
        rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%npattern>
            <charset>UTF-8charset>
        encoder>
    appender>
    
    <root level="INFO">
        
        <appender-ref ref="FILE"/>
    root>
configuration>

你可能感兴趣的:(spring-boot,logback.xml,日志规范,linux,java,java,spring-boot)