Unable to use Spring Property Placeholders in logback.xml

后端 未结 5 1443
有刺的猬
有刺的猬 2020-12-04 22:08

I have a Spring Boot console app using Logback. All of the properties (for the app as well as for Logback) are externalized into a standard application.properties file in th

5条回答
  •  被撕碎了的回忆
    2020-12-04 22:38

    There is a way to map Spring properties to Logback properties and use them in the Conditions:

    logback-spring.xml
    
    
    
    
    
    
    
    
    
    
        
            
                ${ACTIVE_PROFILE}/${HOSTNAME}/testappender.log
                
                    
                        {ACTIVE_PROFILE}/${HOSTNAME}/testappender-%d{yyyy-MM-dd}.%i.log
                    
                    300MB
                    3
                    1GB
                
                
                    %msg%n
                
            
            
                
            
        
    
    
    

提交回复
热议问题