How to configure maven to use different log4j.properties files in different environments

前端 未结 6 2216
栀梦
栀梦 2020-12-05 14:23

I want to be able to use different log4j configuration for different environments.

In my development environment, I want to use log4j.properties (A). But when I bui

6条回答
  •  醉话见心
    2020-12-05 14:52

    You can use profiles to achieve the desired behavior:

    
        
            
                org.apache.maven.plugins
                maven-resources-plugin
                2.5
                
                    
                        log4j
                        process-resources
                        
                            copy-resources
                        
                        
                            output_directory
                            
                                ${log4j.file}
                            
                        
                    
                
            
        
    
    
    
        
            dev
            
                true
            
            
                path_to_file_A
            
        
        
            prod
            
                path_to_file_B
            
        
    
    

提交回复
热议问题