I think you're looking for the file inclusion feature. Create the common base functionality in one file that has as its root an <included>
element, and then include it from your various configuration files with the <include>
element.
This is described, with an example, in the Configuration chapter of the manual:
Joran supports including parts of a configuration file from another file. This is done by declaring a <include>
element, as shown below:
Example: File include (logback-examples/src/main/resources/chapters/configuration/containingConfig.xml)
<configuration>
<include file="src/main/java/chapters/configuration/includedConfig.xml"/>
<root level="DEBUG">
<appender-ref ref="includedConsole" />
</root>
</configuration>
The target file MUST have its elements nested inside an <included>
element. For example, a ConsoleAppender
could be declared as:
Example: File include (logback-examples/src/main/resources/chapters/configuration/includedConfig.xml)
<included>
<appender name="includedConsole" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>"%d - %m%n"</pattern>
</encoder>
</appender>
</included>
Again, please note the mandatory <included>
element.
The contents to include can be referenced as a file, as a resource, or as a URL.