log4j2 xml configuration - Log to file and console (with different levels)

前端 未结 5 1037
情深已故
情深已故 2020-12-24 10:58

I want to do two things:

  1. Log to console with a certain log-level
  2. Log to file with another log-level

Console logging seems to work just

5条回答
  •  自闭症患者
    2020-12-24 11:41

    I use and to do this

    • Console: output all
    • app.log: >= info, except error
    • error.log: >= error

    SEE

          
     
        
            Your log's path
        
        
            
                
            
            
                
                
                
                    %d{yyy-MM-dd HH:mm:ss.SSS} [%t] %level %logger{36} - %msg%n
                
                
                    
                
            
            
                
                    %d{yyy-MM-dd HH:mm:ss.SSS} [%t] %level %logger{36} - %msg%n
                
                
                    
                
            
        
        
            
                
                
                
            
        
    
    

提交回复
热议问题