private static void configureLogbackScanPeriod(long millis) { Logger l = LoggerFactory.getLogger(AggregationTest.class); ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) l; LoggerContext ctx = logbackLogger.getLoggerContext(); TurboFilterList turboFilterList = ctx.getTurboFilterList(); boolean done = false; for (TurboFilter turboFilter : turboFilterList) { if (turboFilter instanceof ReconfigureOnChangeFilter) { ReconfigureOnChangeFilter reconfigureFilter = (ReconfigureOnChangeFilter) turboFilter; reconfigureFilter.setRefreshPeriod(millis); reconfigureFilter.stop(); reconfigureFilter.start(); // start() sets the next check timestammp done = true; break; } } assertTrue("ReconfigureOnChangeFilter not in logback's turbo-filter list - do that by adding scan=\"true\" to logback-test.xml's configuration element", done); }
public TurboFilterList getTurboFilterList() { return turboFilterList; }
private TurboFilter getFirstTurboFilter() { TurboFilterList turboFilterList = loggerContext.getTurboFilterList(); return turboFilterList.get(0); }