Configuring log4j2 and log4j using a single log4j2 xml file

后端 未结 2 1275
甜味超标
甜味超标 2020-12-02 23:14

I\'ve migrated my application to log4j 2, and I\'ve configured it via log4j2.xml

However, some of the libraries I\'m using depend on log4j 1. If I run the applicatio

2条回答
  •  日久生厌
    2020-12-03 00:03

    In a maven project using log4j2, it is possible to exclude log4j from modules that use it, in the pom, in order to enable log4j2 to take over:

    
        
            commons-configuration
            commons-configuration
            1.4
            
            
                
                    log4j
                    log4j
                
            
        
        
            org.apache.logging.log4j
            log4j-api
            2.3
        
        
            org.apache.logging.log4j
            log4j-core
            2.3
        
        
            org.apache.logging.log4j
            log4j-1.2-api
            2.3
        
        
            org.apache.logging.log4j
            log4j-web
            2.3
        
    
    

    More info about that in the log4j FAQ

提交回复
热议问题