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

后端 未结 7 762
[愿得一人]
[愿得一人] 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:09

    The default file appender is size based (10MB).

    In your logback.xml just configure a TimeBasedRollingPolicy as described here

    I.e. something like:

    
    
      
    
      
        ${LOG_FILE}
        
    
            
            ${LOG_FILE}.%d{yyyy-MM-dd}.log
    
        
      
    
      
        
      
    
      
    
    

提交回复
热议问题