How to configure rolling file appender within Spring Boot's application.yml

后端 未结 7 761
[愿得一人]
[愿得一人] 2020-12-01 17:35

Is is possible to configure a daily file appender within the application.yml of a Spring Boot application?

i.e. filenamePattern: myfile.%d{yyyy-MM-dd-HH-mm-ss}.log

7条回答
  •  無奈伤痛
    2020-12-01 18:19

    You can also configure rolling policy based on file size in your logback-spring.xml. In the below, we are specifying max file size as 10MB for SizeBasedTriggeringPolicy:

    
    
        
    
            
            
            
    
            
                
                    ${FILE_LOG_PATTERN}
                
                ${LOG_FILE}
                
                    
                    ${LOG_FILE}.%i.gz
                     1
                    10
                
                
                    10MB
                
            
    
            
                
            
    
        
    

提交回复
热议问题