From 99ccca7986b5fb0fd029946e92623c0ac4d3868e Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Mon, 4 Mar 2024 12:34:59 +0100 Subject: [PATCH] fix /issues/785 Signed-off-by: Ceki Gulcu --- .../logback/core/joran/action/ActionUtil.java | 31 ------------------- .../ch/qos/logback/core/model/ModelUtil.java | 30 ++++++++++++++++++ 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java index 726bc0745c..54054ef413 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java +++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java @@ -38,18 +38,6 @@ static public Scope stringToScope(String scopeStr) { return Scope.LOCAL; } -// static public void setProperty(SaxEventInterpretationContext ic, String key, String value, Scope scope) { -// switch (scope) { -// case LOCAL: -// ic.addSubstitutionProperty(key, value); -// break; -// case CONTEXT: -// ic.getContext().putProperty(key, value); -// break; -// case SYSTEM: -// OptionHelper.setSystemProperty(ic, key, value); -// } -// } static public void setProperty(ContextAwarePropertyContainer ic, String key, String value, Scope scope) { switch (scope) { @@ -63,23 +51,4 @@ static public void setProperty(ContextAwarePropertyContainer ic, String key, Str OptionHelper.setSystemProperty(ic, key, value); } } - -// /** -// * Add all the properties found in the argument named 'props' to an -// * InterpretationContext. -// */ -// static public void setProperties(SaxEventInterpretationContext ic, Properties props, Scope scope) { -// switch (scope) { -// case LOCAL: -// ic.addSubstitutionProperties(props); -// break; -// case CONTEXT: -// ContextUtil cu = new ContextUtil(ic.getContext()); -// cu.addProperties(props); -// break; -// case SYSTEM: -// OptionHelper.setSystemProperties(ic, props); -// } -// } - } diff --git a/logback-core/src/main/java/ch/qos/logback/core/model/ModelUtil.java b/logback-core/src/main/java/ch/qos/logback/core/model/ModelUtil.java index 22970ddff5..4ab506f69f 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/model/ModelUtil.java +++ b/logback-core/src/main/java/ch/qos/logback/core/model/ModelUtil.java @@ -13,6 +13,12 @@ */ package ch.qos.logback.core.model; +import ch.qos.logback.core.joran.action.ActionUtil.Scope; +import ch.qos.logback.core.model.processor.ModelInterpretationContext; +import ch.qos.logback.core.model.util.PropertyModelHandlerHelper; + +import java.util.Properties; + public class ModelUtil { @@ -22,4 +28,28 @@ static public void resetForReuse(Model model) { model.resetForReuse(); } + + + /** + * Add all the properties found in the argument named 'props' to an + * ModelInterpretationContext. + * + * @deprecated moved to {@link PropertyModelHandlerHelper#setProperty} + */ + @Deprecated + static public void setProperty(ModelInterpretationContext mic, String key, String value, Scope scope) { + PropertyModelHandlerHelper.setProperty(mic, key, value, scope); + } + + /** + * Add all the properties found in the argument named 'props' to an + * ModelInterpretationContext. + * + * @deprecated moved to {@link PropertyModelHandlerHelper#setProperties} + */ + @Deprecated + static public void setProperties(ModelInterpretationContext mic, Properties props, Scope scope) { + PropertyModelHandlerHelper.setProperties(mic, props, scope); + } + }