How can I configure Logback to log different levels for a logger to different destinations?

前端 未结 12 1816
挽巷
挽巷 2020-11-28 18:37

How can I configure Logback to log different levels for a logger to different destinations?

For example, given the following Logback configuration, will Logback reco

12条回答
  •  时光说笑
    2020-11-28 18:54

    okay, here is my favorite xml way of doing it. I do this for the eclipse version so I can

    • click on stuff to take me to the log statements and
    • see info and below in black and warn/severe in red

    and for some reason SO is not showing this all properly but most seems to be there...

    
    
        
                  
               
                
                   e.level.toInt() <= INFO.toInt()
                
              
              DENY
              NEUTRAL
            
    
            
                %date{ISO8601} %X{sessionid}-%X{user} %caller{1} %-4level: %message%n
            
        
    
        
             
                warn
            
    
            
                %date{ISO8601} %X{sessionid}-%X{user} %caller{1} %-4level: %message%n
            
            System.err
        
    
        
            
            
            
        
    
    

提交回复
热议问题