本文整理汇总了Java中ch.qos.logback.classic.turbo.TurboFilter类的典型用法代码示例。如果您正苦于以下问题:Java TurboFilter类的具体用法?Java TurboFilter怎么用?Java TurboFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TurboFilter类属于ch.qos.logback.classic.turbo包,在下文中一共展示了TurboFilter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureLogbackScanPeriod
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
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);
}
示例2: addFilter
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@RequestMapping(value = "/1.0/admin/logging/logger/_add", method = RequestMethod.GET)
public @ResponseBody
Object addFilter(@NotEmpty(message = "You must specify a 'logger' param") @RequestParam(required = false) String logger,
@RequestParam(required = false, defaultValue = "trace") String level)
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
for(TurboFilter filter : context.getTurboFilterList())
{
if(DynamicLoggerFilter.class.equals(filter.getClass()))
{
for(Logger l : context.getLoggerList())
{
if(l.getName().endsWith(logger))
((DynamicLoggerFilter)filter).addOverride(l, level);
}
return ((DynamicLoggerFilter)filter).getRegisteredFilters();
}
}
return "DynamicLoggerFilter not configured. Please check logback.xml.";
}
示例3: dropFilter
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@RequestMapping(value = "/1.0/admin/logging/logger/_drop", method = RequestMethod.GET)
public @ResponseBody
Object dropFilter(@NotEmpty(message = "You must specify a 'logger' param") @RequestParam(required = false) String logger)
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
for(TurboFilter filter : context.getTurboFilterList())
{
if(DynamicLoggerFilter.class.equals(filter.getClass()))
{
for(Logger l : context.getLoggerList())
{
if(l.getName().equals(logger))
((DynamicLoggerFilter)filter).dropOverride(l);
}
return ((DynamicLoggerFilter)filter).getRegisteredFilters();
}
}
return "DynamicLoggerFilter not configured. Please check logback.xml.";
}
示例4: resetTurboFilterList
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
public void resetTurboFilterList() {
Iterator i$ = this.turboFilterList.iterator();
while(i$.hasNext()) {
TurboFilter tf = (TurboFilter)i$.next();
tf.stop();
}
this.turboFilterList.clear();
}
示例5: handleContextRefresh
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@EventListener
public void handleContextRefresh(final ContextRefreshedEvent event) {
final LoggerContext loggerContext = ((Logger) LoggerFactory.getLogger("")).getLoggerContext();
loggerContext.addTurboFilter(new TurboFilter() {
@Override
public FilterReply decide(final Marker marker, final Logger logger, final Level level, final String format,
final Object[] params, final Throwable t) {
return TraceThreadLoggingSupport.isTraceActive() ? FilterReply.ACCEPT : FilterReply.NEUTRAL;
}
});
LOGGER.info("ThreadLogging support initialized");
}
示例6: resetTurboFilterList
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
/**
* First processPriorToRemoval all registered turbo filters and then clear the registration
* list.
*/
public void resetTurboFilterList() {
for (TurboFilter tf : turboFilterList) {
tf.stop();
}
turboFilterList.clear();
}
示例7: turboFilter
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@Test
public void turboFilter() throws JoranException {
// Although this test uses turbo filters, it only checks
// that Joran can see the xml element and create
// and place the relevant object correctly.
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "turbo.xml");
TurboFilter filter = loggerContext.getTurboFilterList().get(0);
assertTrue(filter instanceof NOPTurboFilter);
}
示例8: testTurboFilterWithStringList
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@Test
public void testTurboFilterWithStringList() throws JoranException {
// Although this test uses turbo filters, it only checks
// that Joran can see <user> elements, and behave correctly
// that is call the addUser method and pass the correct values
// to that method.
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "turbo2.xml");
// StatusPrinter.print(loggerContext.getStatusManager());
TurboFilter filter = loggerContext.getTurboFilterList().get(0);
assertTrue(filter instanceof DebugUsersTurboFilter);
DebugUsersTurboFilter dutf = (DebugUsersTurboFilter) filter;
assertEquals(2, dutf.getUsers().size());
}
示例9: getFilters
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@RequestMapping(value = "/1.0/admin/logging/mdc", method = RequestMethod.GET)
public @ResponseBody
Object getFilters()
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
for (TurboFilter filter : context.getTurboFilterList())
{
if (DynamicMDCFilter.class.equals(filter.getClass()))
{
return ((DynamicMDCFilter) filter).getRegisteredFilters();
}
}
return "DynamicMDCFilter not configured. Please check logback.xml.";
}
示例10: dropAllFilter
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@RequestMapping(value = "/1.0/admin/logging/mdc/_dropAll", method = RequestMethod.GET)
public @ResponseBody
Object dropAllFilter()
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
for(TurboFilter filter : context.getTurboFilterList())
{
if(DynamicMDCFilter.class.equals(filter.getClass()))
{
((DynamicMDCFilter)filter).clear();
return ((DynamicMDCFilter)filter).getRegisteredFilters();
}
}
return "DynamicMDCFilter not configured. Please check logback.xml.";
}
示例11: getFilters
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@RequestMapping(value = "/1.0/admin/logging/logger", method = RequestMethod.GET)
public @ResponseBody
Object getFilters()
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
for (TurboFilter filter : context.getTurboFilterList())
{
if (DynamicLoggerFilter.class.equals(filter.getClass()))
{
return ((DynamicLoggerFilter) filter).getRegisteredFilters();
}
}
return "DynamicLoggerFilter not configured. Please check logback.xml.";
}
示例12: dropAllFilter
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
@RequestMapping(value = "/1.0/admin/logging/logger/_dropAll", method = RequestMethod.GET)
public @ResponseBody
Object dropAllFilter()
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
for(TurboFilter filter : context.getTurboFilterList())
{
if(DynamicLoggerFilter.class.equals(filter.getClass()))
{
((DynamicLoggerFilter)filter).clear();
return ((DynamicLoggerFilter)filter).getRegisteredFilters();
}
}
return "DynamicLoggerFilter not configured. Please check logback.xml.";
}
示例13: addTurboFilter
import ch.qos.logback.classic.turbo.TurboFilter; //导入依赖的package包/类
public void addTurboFilter(TurboFilter newFilter) {
turboFilterList.add(newFilter);
}