@Override protected ElementPath initialElementPath() { return new ElementPath("configuration"); }
static public void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegistry registry) { registry.add(AppenderBase.class, "layout", PatternLayout.class); registry.add(UnsynchronizedAppenderBase.class, "layout", PatternLayout.class); registry.add(AppenderBase.class, "encoder", PatternLayoutEncoder.class); registry.add(UnsynchronizedAppenderBase.class, "encoder", PatternLayoutEncoder.class); registry.add(EvaluatorFilter.class, "evaluator", JaninoEventEvaluator.class); SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry); }
@Override public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException { seList = new ArrayList<SaxEvent>(); ic.addInPlayListener(this); }
public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != root) { addWarn("The object on the top the of the stack is not the root logger"); addWarn("It is: " + o); } else { ec.popObject(); } }
@Override public void end(InterpretationContext ic, String name) throws ActionException { if (inError) return; ic.getContext().register(receiver); receiver.start(); Object o = ic.peekObject(); if (o != receiver) { addWarn("The object at the of the stack is not the remote " + "pushed earlier."); } else { ic.popObject(); } }
@Override public void end(InterpretationContext ic, String name) throws ActionException { ic.removeInPlayListener(this); Object o = ic.peekObject(); if (o instanceof SiftingAppender) { SiftingAppender sa = (SiftingAppender) o; Map<String, String> propertyMap = ic.getCopyOfPropertyMap(); AppenderFactoryUsingJoran appenderFactory = new AppenderFactoryUsingJoran(seList, sa.getDiscriminatorKey(), propertyMap); sa.setAppenderFactory(appenderFactory); } }
@Override protected void buildInterpreter() { super.buildInterpreter(); Map<String, Object> omap = interpreter.getInterpretationContext().getObjectMap(); omap.put(ActionConst.APPENDER_BAG, new HashMap<String, Appender<?>>()); //omap.put(ActionConst.FILTER_CHAIN_BAG, new HashMap()); Map<String, String> propertiesMap = new HashMap<String, String>(); propertiesMap.putAll(parentPropertyMap); propertiesMap.put(key, value); interpreter.setInterpretationContextPropertiesMap(propertiesMap); }
@Override protected void addInstanceRules(RuleStore rs) { super.addInstanceRules(rs); rs.addRule(new ElementSelector("configuration/appender"), new AppenderAction<ILoggingEvent>()); }
private void addEventsToPlayer(InterpretationContext ic) { Interpreter interpreter = ic.getJoranInterpreter(); this.events.remove(0); this.events.remove(this.events.size() - 1); interpreter.getEventPlayer().addEventsDynamically(this.events, 1); }
@Override public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException { String className = attributes.getValue(CLASS_ATTRIBUTE); if (OptionHelper.isEmpty(className)) { addError("Missing class name for receiver. Near [" + name + "] line " + getLineNumber(ic)); inError = true; return; } try { addInfo("About to instantiate receiver of type [" + className + "]"); receiver = (ReceiverBase) OptionHelper.instantiateByClassName(className, ReceiverBase.class, context); receiver.setContext(context); ic.pushObject(receiver); } catch (Exception ex) { inError = true; addError("Could not create a receiver of type [" + className + "].", ex); throw new ActionException(ex); } }
@SuppressWarnings("unchecked") public Appender<ILoggingEvent> getAppender() { Map<String, Object> omap = interpreter.getInterpretationContext().getObjectMap(); HashMap<String, Appender<?>> appenderMap = (HashMap<String, Appender<?>>) omap.get(ActionConst.APPENDER_BAG); oneAndOnlyOneCheck(appenderMap); Collection<Appender<?>> values = appenderMap.values(); if (values.size() == 0) { return null; } return (Appender<ILoggingEvent>) values.iterator().next(); } }
public void end(InterpretationContext ec, String name) { addInfo("End of configuration."); ec.popObject(); } }
@Override public void end(InterpretationContext ic, String name) throws ActionException { this.depth--; if (this.depth != 0) { return; } ic.removeInPlayListener(this); verifyAndPop(ic); if (this.acceptsProfile) { addEventsToPlayer(ic); } }
public void body(InterpretationContext ec, String body) { String finalBody = ec.subst(body); addInfo("Setting logger context name as [" + finalBody + "]"); try { context.setName(finalBody); } catch (IllegalStateException e) { addError("Failed to rename context [" + context.getName() + "] as [" + finalBody + "]", e); } }
@Override @DefaultClass(MDCBasedDiscriminator.class) public void setDiscriminator(Discriminator<ILoggingEvent> discriminator) { super.setDiscriminator(discriminator); }
void detachReconfigurationToNewThread() { addInfo("Detected change in [" + configurationWatchList.getCopyOfFileWatchList() + "]"); context.getExecutorService().submit(new ReconfiguringThread()); }
protected boolean changeDetected(long now) { if (now >= nextCheck) { updateNextCheck(now); return configurationWatchList.changeDetected(); } return false; }
public void end(InterpretationContext ec, String e) { if (inError) { return; } Object o = ec.peekObject(); if (o != logger) { addWarn("The object on the top the of the stack is not " + logger + " pushed earlier"); addWarn("It is: " + o); } else { ec.popObject(); } }
private void verifyAndPop(InterpretationContext ic) { Object o = ic.peekObject(); Assert.state(o != null, "Unexpected null object on stack"); Assert.isInstanceOf(SpringProfileAction.class, o, "logback stack error"); Assert.state(o == this, "ProfileAction different than current one on stack"); ic.popObject(); }
@Override public void end(InterpretationContext ec, String name) throws ActionException { if (inError) { return; } Object o = ec.peekObject(); if (o != lcl) { addWarn("The object on the top the of the stack is not the LoggerContextListener pushed earlier."); } else { if (lcl instanceof LifeCycle) { ((LifeCycle) lcl).start(); addInfo("Starting LoggerContextListener"); } ((LoggerContext) context).addListener(lcl); ec.popObject(); } }