} 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)); addStatus(errorStatus);
} 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)); addStatus(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));
"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));
/** * 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; }
} 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)); addStatus(errorStatus);
} 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)); addStatus(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));
"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));
"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));
} 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)); addStatus(errorStatus);
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; } }
"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));
} 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)); addStatus(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));
} 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)); addStatus(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));
} 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)); addStatus(errorStatus);
public void testEffectiveLevel() { { // effective level = 0 level deep ErrorStatus status = new ErrorStatus("error", this); WarnStatus warn = new WarnStatus("warning", this); status.add(warn); assertEquals("effective level misevaluated", status.getEffectiveLevel(), Status.ERROR); } { // effective level = 1 level deep InfoStatus status = new InfoStatus("info", this); WarnStatus warn = new WarnStatus("warning", this); status.add(warn); assertEquals("effective level misevaluated", status.getEffectiveLevel(), Status.WARN); } { // effective level = 2 levels deep InfoStatus status = new InfoStatus("info", this); WarnStatus warn = new WarnStatus("warning", this); ErrorStatus error = new ErrorStatus("error", this); status.add(warn); warn.add(error); assertEquals("effective level misevaluated", status.getEffectiveLevel(), Status.ERROR); } }