@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()); }
String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, scope);
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attrubute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; } String datePatternStr = attributes.getValue(DATE_PATTERN_ATTRIBUTE); if (OptionHelper.isEmpty(datePatternStr)) { addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; } if (inError) return; SimpleDateFormat sdf = new SimpleDateFormat(datePatternStr); String val = sdf.format(new Date()); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the context"); context.putProperty(keyStr, val); }
@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()); }
String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the context"); context.putProperty(keyStr, val);
@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()); }
String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the context"); context.putProperty(keyStr, val);
@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()); }
String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, 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()); }
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; } String datePatternStr = attributes.getValue(DATE_PATTERN_ATTRIBUTE); if (OptionHelper.isEmpty(datePatternStr)) { addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; } String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE); long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); } if (inError) return; String scopeStr = attributes.getValue(SCOPE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(scopeStr); CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, 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()); }
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; } String datePatternStr = attributes.getValue(DATE_PATTERN_ATTRIBUTE); if (OptionHelper.isEmpty(datePatternStr)) { addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; } String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE); long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); } if (inError) return; String scopeStr = attributes.getValue(SCOPE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(scopeStr); CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, 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()); }
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; } String datePatternStr = attributes.getValue(DATE_PATTERN_ATTRIBUTE); if (OptionHelper.isEmpty(datePatternStr)) { addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; } String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE); long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); } if (inError) return; String scopeStr = attributes.getValue(SCOPE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(scopeStr); CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, scope); }
@Override protected void addInstanceRules(RuleStore rs) { 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/shutdownHook"), new ShutdownHookAction()); rs.addRule(new ElementSelector("configuration/define"), new DefinePropertyAction()); rs.addRule(new ElementSelector("configuration/conversionRule"), new ConversionRuleAction()); rs.addRule(new ElementSelector("configuration/statusListener"), new StatusListenerAction()); rs.addRule(new ElementSelector("configuration/appender"), new AppenderAction<E>()); rs.addRule(new ElementSelector("configuration/appender/appender-ref"), new AppenderRefAction<E>()); rs.addRule(new ElementSelector("configuration/newRule"), new NewRuleAction()); rs.addRule(new ElementSelector("*/param"), new ParamAction()); }
String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, scope);
@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new Pattern("configuration/property"), new PropertyAction()); rs.addRule(new Pattern("configuration/substitutionProperty"), new PropertyAction()); rs.addRule(new Pattern("configuration/timestamp"), new TimestampAction()); // the contextProperty pattern is deprecated. It is undocumented // and will be dropped in future versions of logback rs.addRule(new Pattern("configuration/contextProperty"), new ContextPropertyAction()); rs.addRule(new Pattern("configuration/conversionRule"), new ConversionRuleAction()); rs.addRule(new Pattern("configuration/statusListener"), new StatusListenerAction()); rs.addRule(new Pattern("configuration/appender"), new AppenderAction()); rs.addRule(new Pattern("configuration/appender/appender-ref"), new AppenderRefAction()); rs.addRule(new Pattern("configuration/newRule"), new NewRuleAction()); rs.addRule(new Pattern("*/param"), new ParamAction()); }
@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new Pattern("configuration/variable"), new PropertyAction()); rs.addRule(new Pattern("configuration/property"), new PropertyAction()); rs.addRule(new Pattern("configuration/substitutionProperty"), new PropertyAction()); rs.addRule(new Pattern("configuration/timestamp"), new TimestampAction()); rs.addRule(new Pattern("configuration/define"), new DefinePropertyAction()); // the contextProperty pattern is deprecated. It is undocumented // and will be dropped in future versions of logback rs.addRule(new Pattern("configuration/contextProperty"), new ContextPropertyAction()); rs.addRule(new Pattern("configuration/conversionRule"), new ConversionRuleAction()); rs.addRule(new Pattern("configuration/statusListener"), new StatusListenerAction()); rs.addRule(new Pattern("configuration/appender"), new AppenderAction()); rs.addRule(new Pattern("configuration/appender/appender-ref"), new AppenderRefAction()); rs.addRule(new Pattern("configuration/newRule"), new NewRuleAction()); rs.addRule(new Pattern("*/param"), new ParamAction()); }
@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new Pattern("configuration/variable"), new PropertyAction()); rs.addRule(new Pattern("configuration/property"), new PropertyAction()); rs.addRule(new Pattern("configuration/substitutionProperty"), new PropertyAction()); rs.addRule(new Pattern("configuration/timestamp"), new TimestampAction()); rs.addRule(new Pattern("configuration/define"), new DefinePropertyAction()); // the contextProperty pattern is deprecated. It is undocumented // and will be dropped in future versions of logback rs.addRule(new Pattern("configuration/contextProperty"), new ContextPropertyAction()); rs.addRule(new Pattern("configuration/conversionRule"), new ConversionRuleAction()); rs.addRule(new Pattern("configuration/statusListener"), new StatusListenerAction()); rs.addRule(new Pattern("configuration/appender"), new AppenderAction()); rs.addRule(new Pattern("configuration/appender/appender-ref"), new AppenderRefAction()); rs.addRule(new Pattern("configuration/newRule"), new NewRuleAction()); rs.addRule(new Pattern("*/param"), new ParamAction()); }