Spring5集成log4j2

之前配置log4j错误,一直报错

ERROR StatusLogger No log4j2 configuration file found. Using default configuration

查了许多总算配置成功了。记录


1,添加maven依赖

    
      org.apache.logging.log4j
      log4j-core
      2.7
    
    
    
      org.apache.logging.log4j
      log4j-web
      2.7
    
    
    
      org.apache.logging.log4j
      log4j-api
      2.7
    

2,配置web.xml


    
    
        log4jContextName
        star
    
    
        log4jConfiguration
        classpath:profiles/log4j2.xml
    

注意配置
log4jConfiguration很多这个配置错了

3,log4j.xml



    
        
            
        
    
    
        
        
            
        
    


你可能感兴趣的:(SpringMVC)