Spring Boot 集成日志 logging sl4j

Spring Boot 集成日志 logging sl4j

1.配置:src/main/resources/application.properties

logging.config=classpath:logback-spring.xml
  1. logback-spring.xml





    
    ${APP_NAME}
    
    

    
    

    
        
            
            ${user.home}/logs/${APP_NAME}.%d{yyyy-MM-dd}.log
            
            30
        
        
            INFO
        
        
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg %n
        
    
    
    
        
        
        
    



  1. dependencies中添加依赖
dependencies {
    compile('org.springframework.boot:spring-boot-starter-logging')
}

完整工程示例:

https://github.com/EasyKotlin/chatper15_net_io_img_crawler

你可能感兴趣的:(Spring Boot 集成日志 logging sl4j)