inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new ElementSelector(pattern), errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg);
@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()); }
public static void main(String[] args) throws Exception { Context context = new ContextBase(); Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>(); // we start with the rule for the top-most (root) element ruleMap.put(new ElementSelector("*/computation"), new ComputationAction1()); // Associate "/new-rule" pattern with NewRuleAction from the // org.apache.joran.action package. // // We will let the XML file to teach the Joran interpreter about new rules ruleMap.put(new ElementSelector("/computation/newRule"), new NewRuleAction()); SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap); // link the configurator with its context simpleConfigurator.setContext(context); simpleConfigurator.doConfigure(args[0]); // Print any errors that might have occured. StatusPrinter.printInCaseOfErrorsOrWarnings(context); }
inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new Pattern(pattern), errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg);
@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()); }
/** * Instantiates an layout of the given class and sets its name. */ public void begin(InterpretationContext ec, String localName, Attributes attributes) { // Let us forget about previous errors (in this object) inError = false; String errorMsg; String pattern = attributes.getValue(Action.PATTERN_ATTRIBUTE); String actionClass = attributes.getValue(Action.ACTION_CLASS_ATTRIBUTE); if (OptionHelper.isEmpty(pattern)) { inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; } if (OptionHelper.isEmpty(actionClass)) { inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; } try { addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new ElementSelector(pattern), actionClass); } catch (Exception oops) { inError = true; errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg); } }
@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()); }
/** * Instantiates an layout of the given class and sets its name. */ public void begin(InterpretationContext ec, String localName, Attributes attributes) { // Let us forget about previous errors (in this object) inError = false; String errorMsg; String pattern = attributes.getValue(Action.PATTERN_ATTRIBUTE); String actionClass = attributes.getValue(Action.ACTION_CLASS_ATTRIBUTE); if (OptionHelper.isEmpty(pattern)) { inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; } if (OptionHelper.isEmpty(actionClass)) { inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; } try { addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new ElementSelector(pattern), actionClass); } catch (Exception oops) { inError = true; errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg); } }
@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()); }
/** * Instantiates an layout of the given class and sets its name. */ public void begin(InterpretationContext ec, String localName, Attributes attributes) { // Let us forget about previous errors (in this object) inError = false; String errorMsg; String pattern = attributes.getValue(Action.PATTERN_ATTRIBUTE); String actionClass = attributes.getValue(Action.ACTION_CLASS_ATTRIBUTE); if (OptionHelper.isEmpty(pattern)) { inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; } if (OptionHelper.isEmpty(actionClass)) { inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; } try { addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new ElementSelector(pattern), actionClass); } catch (Exception oops) { inError = true; errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg); } }
@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()); }
inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new ElementSelector(pattern), errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg);
@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/shutdownHook"), new ShutdownHookAction()); 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<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(getBeanDescriptionCache())); }
inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new Pattern(pattern), errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg);
@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/shutdownHook"), new ShutdownHookAction()); 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<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(getBeanDescriptionCache())); }
inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new ElementSelector(pattern), errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg);
@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/shutdownHook"), new ShutdownHookAction()); 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<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(getBeanDescriptionCache())); }
inError = true; errorMsg = "No 'pattern' attribute in <newRule>"; addError(errorMsg); return; inError = true; errorMsg = "No 'actionClass' attribute in <newRule>"; addError(errorMsg); return; addInfo("About to add new Joran parsing rule [" + pattern + "," + actionClass + "]."); ec.getJoranInterpreter().getRuleStore().addRule(new Pattern(pattern), errorMsg = "Could not add new Joran parsing rule [" + pattern + "," + actionClass + "]"; addError(errorMsg);
@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/shutdownHook"), new ShutdownHookAction()); 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()); }