2018 SSM統合logbackログ

4669 ワード

一、pom.xml
二、logback.xml
三、テスト
四、構成の詳細

一、pom.xml



    ch.qos.logback
    logback-classic
    1.2.2

二、logback.xml

1. 



    
        
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
        
    
    
        
    


2. 



    
    
        
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
            UTF-8
        
    
    
    
        
            
            
            ./log/error/daotong-error-%d{yyyy-MM-dd}.log
            
            60
        
        
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
            UTF-8
        
        
        
            ERROR
            ACCEPT
            DENY
        
    
    
    
        
            
            ./log/warn/daotong-warn-%d{yyyy-MM-dd}.log
            
            60
        
        
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
            UTF-8
        
        
        
            WARN
            ACCEPT
            DENY
        
    
    
    
        
            
            ./log/info/daotong-info-%d{yyyy-MM-dd}.log
            
            60
        
        
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
            UTF-8
        
        
        
            INFO
            ACCEPT
            DENY
        
    
    
    
        
        
        
        
        
    
    
    
        
    

三、テスト

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by IntelliJ IDEA.
 *
 * @author xlm
 * description:
 * path: ssm-PACKAGE_NAME-Te
 * date: 2018/10/20 15:11
 * version: 02.06
 * To change this template use File | Settings | File Templates.
 */
public class Te {

    private static final Logger logger = LoggerFactory.getLogger(Te.class);

    public static void main(String[] args) {

        logger.info("haha");

    }

}

四、構成の詳細


転送ゲート:https://www.jianshu.com/p/1ded57f6c4e3