SpringBoot 整合 Logback 日志

在 resource 目录下创建 logback-spring.xml 文件




    

    
    
    

    

    
        
            info
        
        
            ${CONSOLE_LOG_PATTERN}
            UTF-8
        
    

    
    
        
        ${log.path}/log_debug.log
        
        
            %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
            UTF-8
        
        
        
            
            ${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log
            
                100MB
            
            
            15
        
        
        
            debug
            ACCEPT
            DENY
        
    

    
        ${log.path}/log_info.log
        
            %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
            UTF-8
        
        
            ${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log
            
                100MB
            
            15
        
        
            info
            ACCEPT
            DENY
        
    

    
        ${log.path}/log_warn.log
        
            %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
            UTF-8
        
        
            ${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log
            
                100MB
            
            15
        
        
            warn
            ACCEPT
            DENY
        
    

    
        ${log.path}/log_error.log
        
            %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
            UTF-8
        
        
            ${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log
            
                100MB
            
            15
        
        
            ERROR
            ACCEPT
            DENY
        
    

    
    
        
        
        
        
        
    

你可能感兴趣的:(springboot,logback)