errorCount++; if (errorCount < MAX_ERROR_COUNT) { addError("Exception thrown for evaluator named [" + ee.getName() + "]", eex); } else if (errorCount == MAX_ERROR_COUNT) { ErrorStatus errorStatus = new ErrorStatus("Exception thrown for evaluator named [" + ee.getName() + "].", this, eex); errorStatus.add(new ErrorStatus("This was the last warning about this evaluator's errors." + "We don't want the StatusManager to get flooded.", this));
errorCount++; if (errorCount < CoreConstants.MAX_ERROR_COUNT) { addError("Exception thrown for evaluator named [" + ee.getName() + "]", eex); } else if (errorCount == CoreConstants.MAX_ERROR_COUNT) { ErrorStatus errorStatus = new ErrorStatus("Exception thrown for evaluator named [" + ee.getName() + "].", this, eex); errorStatus.add(new ErrorStatus("This was the last warning about this evaluator's errors." + "We don't want the StatusManager to get flooded.", this));
errorCount++; if (errorCount < MAX_ERROR_COUNT) { addError("Exception thrown for evaluator named [" + ee.getName() + "]", eex); } else if (errorCount == MAX_ERROR_COUNT) { ErrorStatus errorStatus = new ErrorStatus( "Exception thrown for evaluator named [" + ee.getName() + "].", this, eex); errorStatus.add(new ErrorStatus(
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
errorCount++; if (errorCount < CoreConstants.MAX_ERROR_COUNT) { addError("Exception thrown for evaluator named [" + ee.getName() + "]", eex); } else if (errorCount == CoreConstants.MAX_ERROR_COUNT) { ErrorStatus errorStatus = new ErrorStatus( "Exception thrown for evaluator named [" + ee.getName() + "].", this, eex); errorStatus.add(new ErrorStatus(
/** * Return true if any evaluator returns true, indicating that * the stack trace should not be logged. */ private boolean isExcludedByEvaluator(ILoggingEvent event) { for (int i = 0; i < evaluators.size(); i++) { EventEvaluator<ILoggingEvent> evaluator = evaluators.get(i); try { if (evaluator.evaluate(event)) { return true; } } catch (EvaluationException eex) { int errors = errorCount.incrementAndGet(); if (errors < CoreConstants.MAX_ERROR_COUNT) { addError(String.format("Exception thrown for evaluator named [%s]", evaluator.getName()), eex); } else if (errors == CoreConstants.MAX_ERROR_COUNT) { ErrorStatus errorStatus = new ErrorStatus( String.format("Exception thrown for evaluator named [%s]", evaluator.getName()), this, eex); errorStatus.add(new ErrorStatus( "This was the last warning about this evaluator's errors." + "We don't want the StatusManager to get flooded.", this)); addStatus(errorStatus); } } } return false; }
private boolean evaluate(final String name, final ILoggingEvent event) { final EventEvaluator<ILoggingEvent> evaluator = evaluators.get(name); try { return null != evaluator && evaluator.evaluate(event); } catch (final EvaluationException e) { errors++; if (MAX_ERROR_COUNT > errors) { addError("Exception thrown for evaluator named [" + evaluator.getName() + "]", e); } else if (MAX_ERROR_COUNT == errors) { final ErrorStatus errorStatus = new ErrorStatus( "Exception thrown for evaluator named [" + evaluator.getName() + "].", this, e); errorStatus.add(new ErrorStatus( "This was the last warning about this evaluator's errors." + "We don't want the StatusManager to get flooded.", this)); addStatus(errorStatus); } return false; } }
/** * Once the children elements are also parsed, now is the time to activate the * evaluator options. */ @SuppressWarnings("unchecked") public void end(InterpretationContext ec, String e) { if (inError) { return; } if (evaluator instanceof LifeCycle) { ((LifeCycle) evaluator).start(); addInfo("Starting evaluator named [" + evaluator.getName() + "]"); } Object o = ec.peekObject(); if (o != evaluator) { addWarn("The object on the top the of the stack is not the evaluator pushed earlier."); } else { ec.popObject(); try { Map<String, EventEvaluator> evaluatorMap = (Map<String, EventEvaluator>) context .getObject(CoreConstants.EVALUATOR_MAP); evaluatorMap.put(evaluator.getName(), evaluator); } catch (Exception ex) { addError("Could not set evaluator named [" + evaluator + "].", ex); } } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
public FilterReply decide(E event) { // let us not throw an exception // see also bug #17. if (!isStarted() || !evaluator.isStarted()) { return FilterReply.NEUTRAL; } try { if (evaluator.evaluate(event)) { return onMatch; } else { return onMismatch; } } catch (EvaluationException e) { addError("Evaluator " + evaluator.getName() + " threw an exception", e); return FilterReply.NEUTRAL; } }
/** * Once the children elements are also parsed, now is the time to activate the * evaluator options. */ @SuppressWarnings("unchecked") public void end(InterpretationContext ec, String e) { if (inError) { return; } if (evaluator instanceof LifeCycle) { ((LifeCycle) evaluator).start(); addInfo("Starting evaluator named [" + evaluator.getName() + "]"); } Object o = ec.peekObject(); if (o != evaluator) { addWarn("The object on the top the of the stack is not the evaluator pushed earlier."); } else { ec.popObject(); try { Map<String, EventEvaluator<?>> evaluatorMap = (Map<String, EventEvaluator<?>>) context.getObject(CoreConstants.EVALUATOR_MAP); if (evaluatorMap == null) { addError("Could not find EvaluatorMap"); } else { evaluatorMap.put(evaluator.getName(), evaluator); } } catch (Exception ex) { addError("Could not set evaluator named [" + evaluator + "].", ex); } } }
/** * Once the children elements are also parsed, now is the time to activate the * evaluator options. */ @SuppressWarnings("unchecked") public void end(InterpretationContext ec, String e) { if (inError) { return; } if (evaluator instanceof LifeCycle) { ((LifeCycle) evaluator).start(); addInfo("Starting evaluator named [" + evaluator.getName() + "]"); } Object o = ec.peekObject(); if (o != evaluator) { addWarn("The object on the top the of the stack is not the evaluator pushed earlier."); } else { ec.popObject(); try { Map<String, EventEvaluator<?>> evaluatorMap = (Map<String, EventEvaluator<?>>) context.getObject(CoreConstants.EVALUATOR_MAP); if (evaluatorMap == null) { addError("Could not find EvaluatorMap"); } else { evaluatorMap.put(evaluator.getName(), evaluator); } } catch (Exception ex) { addError("Could not set evaluator named [" + evaluator + "].", ex); } } }