logback: Two appenders, multiple loggers, different levels

前端 未结 6 841
小蘑菇
小蘑菇 2020-12-02 07:46

I want to have two log files in my application (Spring Integration), debug.log and main.log. I want to run main.log at an INFO level and debug.log at a DEBUG level. This i

6条回答
  •  無奈伤痛
    2020-12-02 08:04

    Just found a practical solution using logback elements only that works pretty well, essentially you need to have two appenders, one with the default config and the other one with a filter (in my example I'm using the console):

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

提交回复
热议问题