log4j configuration file in a multi-module Maven project

前端 未结 3 1598
生来不讨喜
生来不讨喜 2020-12-28 17:19

I am working on a multi-module Maven project, whose structure is like this:

war-module
jar-module

The war-module depends on the jar-module,

3条回答
  •  无人及你
    2020-12-28 18:02

    From my experience this can be implemented in an easy way , just :

    1. Make the log4j configuration resource at the parent module.
    2. Call the dependency of log4j in all pom modules.

    Detailed steps:

    1. Create a project with common-config
    2. In the src/main/resources folder put the log4j or logback config file
    3. Install the artifact in the local Maven repository to be used by other projects
    4. Add the dependency as a normal Maven dependency in the subsequent projects
     
      com.your.group.id 
      common-config 
      provided 
    
    

    I prefer to use the scope provided and provide the file from a classpath config folder at runtime.

提交回复
热议问题