ch.qos.logback.classic.turbo.TurboFilter Java Examples

The following examples show how to use ch.qos.logback.classic.turbo.TurboFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QpidLoggerTurboFilter.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
public static QpidLoggerTurboFilter installIfNecessary(LoggerContext loggerContext)
{
    QpidLoggerTurboFilter filter = new QpidLoggerTurboFilter();
    if(!loggerContext.getTurboFilterList().addIfAbsent(filter))
    {
        for(TurboFilter candidate : loggerContext.getTurboFilterList())
        {
            if(candidate instanceof QpidLoggerTurboFilter)
            {
                filter = (QpidLoggerTurboFilter)candidate;
                break;
            }
        }
    }
    return filter;
}
 
Example #2
Source File: DefaultLogbackReInitializer.java    From sofa-common-tools with Apache License 2.0 5 votes vote down vote up
@Override
public void reInitialize(final SpaceId spaceId, LoggerContext loggerContext,
                         final Properties properties, URL confFile) {
    if (isAlreadyReInitialized(loggerContext)) {
        return;
    }
    stopAndReset(loggerContext);
    loggerContext.getTurboFilterList().remove(DefaultLogbackFilterGenerator.FILTER);
    markAsReInitialized(loggerContext);
    initProperties(loggerContext, properties);
    if (isConsoleAppenderOpen(spaceId.getSpaceName(), properties)) {
        final ConsoleAppender appender = consoleAppender(loggerContext, properties);
        loggerContext.addTurboFilter(new TurboFilter() {
            @Override
            public FilterReply decide(Marker marker, Logger logger, Level level, String format,
                                      Object[] params, Throwable t) {
                if (!logger.isAttached(appender)) {
                    logger.detachAndStopAllAppenders();
                    logger.setLevel(getConsoleLevel(spaceId.getSpaceName(), properties));
                    logger.addAppender(appender);
                }
                return FilterReply.NEUTRAL;
            }
        });
    } else {
        try {
            new ContextInitializer(loggerContext).configureByResource(confFile);
        } catch (JoranException e) {
            throw new IllegalStateException("Logback loggerSpaceFactory re-build error", e);
        }
    }

}
 
Example #3
Source File: KonkerLoggerContext.java    From konker-platform with Apache License 2.0 5 votes vote down vote up
public void resetTurboFilterList() {
    Iterator i$ = this.turboFilterList.iterator();

    while(i$.hasNext()) {
        TurboFilter tf = (TurboFilter)i$.next();
        tf.stop();
    }

    this.turboFilterList.clear();
}
 
Example #4
Source File: DefaultLogbackFilterGenerator.java    From sofa-common-tools with Apache License 2.0 4 votes vote down vote up
@Override
public TurboFilter[] generatorFilters() {
    return new TurboFilter[] { FILTER };
}
 
Example #5
Source File: LogbackFilterGenerator.java    From sofa-common-tools with Apache License 2.0 votes vote down vote up
TurboFilter[] generatorFilters();