logback: Two appenders, multiple loggers, different levels

前端 未结 6 850
小蘑菇
小蘑菇 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

    Adding an additional solution that is simpler than what's already here

    None of these solutions worked for me, since I'm not using a framework like Spark or Spring. So I did something a bit simpler that seems to function nicely. While this solution may not work for the OP, perhaps it can be of use to someone wanting something not so bulky.

    
    
    
        /path/to/your/program.log
        true
        
            ${pattern}
        
    
    
    
        System.out
        
            INFO
        
        
            ${pattern}
        
    
    
    
        
        
    
    

    With this configuration, I am able to keep the console rather clean, while outputting DEBUG statements to the log file.

提交回复
热议问题