Logging error to stderr and debug, info to stdout with log4j

前端 未结 6 1658
长情又很酷
长情又很酷 2020-12-12 14:14

I want to add logging to an application I am developing, using apache log4j. At this point I want to redirect all log messages for level INFO and lower (TRACE, DEBUG) to std

6条回答
  •  既然无缘
    2020-12-12 15:02

    This is logback config which does exactly(!) what you asking for:

    
    
    
        
            System.out
            
                INFO
                ACCEPT
                DENY
            
            
                
                    %-4relative [%thread] %-5level %logger - %msg%n
                
            
        
    
        
            System.err
            
                WARN
            
            
                
                    %-4relative [%thread] %-5level %logger - %msg%n
                
            
        
    
        
            
            
        
    
    
    

提交回复
热议问题