use of ch.qos.logback.classic.joran.ReconfigureOnChangeTask in project cassandra by apache.
the class AggregationTest method configureLogbackScanPeriod.
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.setContext(ctx);
reconfigureFilter.setRefreshPeriod(millis);
reconfigureFilter.stop();
// start() sets the next check timestammp
reconfigureFilter.start();
done = true;
break;
}
}
ReconfigureOnChangeTask roct = (ReconfigureOnChangeTask) ctx.getObject(RECONFIGURE_ON_CHANGE_TASK);
if (roct != null) {
// Let the test run anyway, just we cannot reconfigure it (and it is pointless to reconfigure).
return;
}
assertTrue("ReconfigureOnChangeFilter not in logback's turbo-filter list - do that by adding scan=\"true\" to logback-test.xml's configuration element", done);
}
Aggregations