ch.qos.logback.core.spi.AppenderAttachable Java Examples

The following examples show how to use ch.qos.logback.core.spi.AppenderAttachable. 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: LogBackConfiguration.java    From summerframework with Apache License 2.0 6 votes vote down vote up
@Override
public void init() {
    LoggerContext loggerContext = (LoggerContext)LoggerFactory.getILoggerFactory();
    if (loggerContext == null)
        return;
    List<Logger> loggerList = loggerContext.getLoggerList();
    ch.qos.logback.classic.Logger loggerKafka =
        loggerContext.getLogger("org.apache.kafka.clients.producer.ProducerConfig");
    if (loggerKafka != null) {
        loggerKafka.setLevel(ch.qos.logback.classic.Level.ERROR);
    }
    createBizLogger();
    for (Logger logger : loggerList) {
        AppenderAttachable appenderAttachable = logger;
        setLayout(loggerContext,appenderAttachable.iteratorForAppenders());
    }
}
 
Example #2
Source File: TestUtil.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
public static StringListAppender<ILoggingEvent> getListAppender(final SLF4JLogger slf4jLogger, final String name) {
    final Logger logger = slf4jLogger.getLogger();
    if (!(logger instanceof AppenderAttachable)) {
        throw new AssertionError("SLF4JLogger.getLogger() did not return an instance of AppenderAttachable");
    }
    @SuppressWarnings("unchecked")
    final AppenderAttachable<ILoggingEvent> attachable = (AppenderAttachable<ILoggingEvent>) logger;
    return getListAppender(attachable, name);
}
 
Example #3
Source File: TestUtil.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
public static StringListAppender<ILoggingEvent> getListAppender(final AppenderAttachable<ILoggingEvent> logger, final String name) {
    return (StringListAppender<ILoggingEvent>) logger.getAppender(name);
}