|
26 | 26 | import ch.qos.logback.classic.model.processor.ConfigurationModelHandlerFull;
|
27 | 27 | import ch.qos.logback.classic.model.processor.LogbackClassicDefaultNestedComponentRules;
|
28 | 28 | import ch.qos.logback.classic.spi.ILoggingEvent;
|
| 29 | +import ch.qos.logback.core.joran.GenericXMLConfigurator; |
29 | 30 | import ch.qos.logback.core.joran.JoranConfiguratorBase;
|
30 | 31 | import ch.qos.logback.core.joran.action.AppenderRefAction;
|
31 | 32 | import ch.qos.logback.core.joran.action.IncludeAction;
|
|
34 | 35 | import ch.qos.logback.core.joran.spi.RuleStore;
|
35 | 36 | import ch.qos.logback.core.model.Model;
|
36 | 37 | import ch.qos.logback.core.model.processor.DefaultProcessor;
|
| 38 | +import ch.qos.logback.core.model.processor.ModelInterpretationContext; |
37 | 39 |
|
38 | 40 | /**
|
39 | 41 | * JoranConfigurator class adds rules specific to logback-classic.
|
|
42 | 44 | */
|
43 | 45 | public class JoranConfigurator extends JoranConfiguratorBase<ILoggingEvent> {
|
44 | 46 |
|
| 47 | + |
| 48 | + |
45 | 49 | @Override
|
46 | 50 | public void addElementSelectorAndActionAssociations(RuleStore rs) {
|
47 | 51 | // add parent rules
|
@@ -81,6 +85,17 @@ protected void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegi
|
81 | 85 | LogbackClassicDefaultNestedComponentRules.addDefaultNestedComponentRegistryRules(registry);
|
82 | 86 | }
|
83 | 87 |
|
| 88 | + private JoranConfigurator makeAnotherInstance() { |
| 89 | + JoranConfigurator jc = new JoranConfigurator(); |
| 90 | + jc.setContext(context); |
| 91 | + return jc; |
| 92 | + } |
| 93 | + |
| 94 | + public void buildModelInterpretationContext() { |
| 95 | + super.buildModelInterpretationContext(); |
| 96 | + this.modelInterpretationContext.setConfiguratorSupplier( () -> this.makeAnotherInstance() ); |
| 97 | + } |
| 98 | + |
84 | 99 | @Override
|
85 | 100 | protected void addModelHandlerAssociations(DefaultProcessor defaultProcessor) {
|
86 | 101 | ModelClassToModelHandlerLinker m = new ModelClassToModelHandlerLinker(context);
|
|
0 commit comments