@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new ElementSelector("configuration/property"), new PropertyAction()); rs.addRule(new ElementSelector("configuration/timestamp"), new TimestampAction()); rs.addRule(new ElementSelector("configuration/define"), new DefinePropertyAction()); }
addError("Missing property name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addError("Missing class name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addInfo("About to instantiate property definer of type [" + className + "]"); definer = (PropertyDefiner) OptionHelper.instantiateByClassName( } catch (Exception oops) { inError = true; addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
addError("Missing property name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addError("Missing class name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addInfo("About to instantiate property definer of type [" + className + "]"); definer = (PropertyDefiner) OptionHelper.instantiateByClassName(className, PropertyDefiner.class, context); definer.setContext(context); } catch (Exception oops) { inError = true; addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
@Override protected void addInstanceRules(RuleStore rs) { // is "configuration/variable" referenced in the docs? rs.addRule(new ElementSelector("configuration/variable"), new PropertyAction()); rs.addRule(new ElementSelector("configuration/property"), new PropertyAction()); rs.addRule(new ElementSelector("configuration/substitutionProperty"), new PropertyAction()); rs.addRule(new ElementSelector("configuration/timestamp"), new TimestampAction()); rs.addRule(new ElementSelector("configuration/define"), new DefinePropertyAction()); // the contextProperty pattern is deprecated. It is undocumented // and will be dropped in future versions of logback rs.addRule(new ElementSelector("configuration/contextProperty"), new ContextPropertyAction()); rs.addRule(new ElementSelector("configuration/conversionRule"), new ConversionRuleAction()); rs.addRule(new ElementSelector("configuration/statusListener"), new StatusListenerAction()); rs.addRule(new ElementSelector("configuration/appender"), new AppenderAction()); rs.addRule(new ElementSelector("configuration/appender/appender-ref"), new AppenderRefAction()); rs.addRule(new ElementSelector("configuration/newRule"), new NewRuleAction()); rs.addRule(new ElementSelector("*/param"), new ParamAction()); }
addError("Missing property name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addError("Missing class name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addInfo("About to instantiate property definer of type [" + className + "]"); definer = (PropertyDefiner) OptionHelper.instantiateByClassName(className, PropertyDefiner.class, context); definer.setContext(context); } catch (Exception oops) { inError = true; addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if (propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
@Before public void setUp() throws Exception { HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>(); rulesMap.put(new ElementSelector("define"), new DefinePropertyAction()); simpleConfigurator = new SimpleConfigurator(rulesMap); simpleConfigurator.setContext(context); }
addError("Missing property name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addError("Missing class name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addInfo("About to instantiate property definer of type [" + className + "]"); definer = (PropertyDefiner) OptionHelper.instantiateByClassName(className, PropertyDefiner.class, context); definer.setContext(context); } catch (Exception oops) { inError = true; addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new ElementSelector("configuration/property"), new PropertyAction()); rs.addRule(new ElementSelector("configuration/timestamp"), new TimestampAction()); rs.addRule(new ElementSelector("configuration/define"), new DefinePropertyAction()); }
addError("Missing property name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addError("Missing class name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addInfo("About to instantiate property definer of type [" + className + "]"); definer = (PropertyDefiner) OptionHelper.instantiateByClassName( } catch (Exception oops) { inError = true; addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if (propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new ElementSelector("configuration/property"), new PropertyAction()); rs.addRule(new ElementSelector("configuration/timestamp"), new TimestampAction()); rs.addRule(new ElementSelector("configuration/define"), new DefinePropertyAction()); }
addError("Missing property name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addError("Missing class name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addInfo("About to instantiate property definer of type [" + className + "]"); definer = (PropertyDefiner) OptionHelper.instantiateByClassName( } catch (Exception oops) { inError = true; addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if (propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new ElementSelector("configuration/property"), new PropertyAction()); rs.addRule(new ElementSelector("configuration/timestamp"), new TimestampAction()); rs.addRule(new ElementSelector("configuration/define"), new DefinePropertyAction()); }
addError("Missing property name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addError("Missing class name for property definer. Near [" + localName + "] line " + getLineNumber(ec)); inError = true; return; addInfo("About to instantiate property definer of type [" + className + "]"); definer = (PropertyDefiner) OptionHelper.instantiateByClassName( } catch (Exception oops) { inError = true; addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }