@Test public void shouldFilterRecords() { handler.setLevel(Level.INFO); handler.publish(new LogRecord(Level.DEBUG, "test")); assertEquals(0, counters.get(Level.DEBUG.intValue()).sum()); }
@Override public void publish(LogRecord record) { if (isLoggable(record)) { Entry<Integer, LongAdder> counter = logCounters.floorEntry(record.getLevel().intValue()); if (counter != null) { counter.getValue().increment(); } else { logCounters.get(Level.TRACE.intValue()).increment(); } } }
LogMetricsHandler extends Handler { @Override public void publish(LogRecord record) { if (isLoggable(record)) { Entry<Integer, LongAdder> counter = logCounters.floorEntry(record.getLevel().intValue()); if (counter != null) { counter.getValue().increment(); } else { logCounters.get(Level.TRACE.intValue()).increment(); } } } }
LogMetricsHandler extends Handler { @Override public void publish(LogRecord record) { if (isLoggable(record)) { Entry<Integer, LongAdder> counter = logCounters.floorEntry(record.getLevel().intValue()); if (counter != null) { counter.getValue().increment(); } else { logCounters.get(Level.TRACE.intValue()).increment(); } } } LogMetricsHandler(NavigableMap<Integer, LongAdder> logCounters); }
LogMetricsHandler extends Handler { @Override public void publish(LogRecord record) { if (isLoggable(record)) { Entry<Integer, LongAdder> counter = logCounters.floorEntry(record.getLevel().intValue()); if (counter != null) { counter.getValue().increment(); } else { logCounters.get(Level.TRACE.intValue()).increment(); } } } LogMetricsHandler(NavigableMap<Integer, LongAdder> logCounters); @Override void publish(LogRecord record); @Override void flush(); @Override void close(); }
LogMetricsHandler extends Handler { @Override public void publish(LogRecord record) { if (isLoggable(record)) { Entry<Integer, LongAdder> counter = logCounters.floorEntry(record.getLevel().intValue()); if (counter != null) { counter.getValue().increment(); } else { logCounters.get(Level.TRACE.intValue()).increment(); } } } LogMetricsHandler(NavigableMap<Integer, LongAdder> logCounters); @Override void publish(LogRecord record); @Override void flush(); @Override void close();  }