Search in sources :

Example 51 with Logger

use of ch.qos.logback.classic.Logger in project drill by apache.

the class LogFixture method setupConsole.

private void setupConsole(LogFixtureBuilder builder) {
    drillLogger = (Logger) LoggerFactory.getLogger(DRILL_PACKAGE_NAME);
    if (drillLogger.getAppender("STDOUT") != null) {
        return;
    }
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    ple = new PatternLayoutEncoder();
    ple.setPattern(builder.consoleFormat);
    ple.setContext(lc);
    ple.start();
    appender = new ConsoleAppender<>();
    appender.setContext(lc);
    appender.setName("Console");
    appender.setEncoder(ple);
    appender.start();
    Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    root.addAppender(appender);
    drillLogger.addAppender(appender);
}
Also used : PatternLayoutEncoder(ch.qos.logback.classic.encoder.PatternLayoutEncoder) Logger(ch.qos.logback.classic.Logger) LoggerContext(ch.qos.logback.classic.LoggerContext)

Example 52 with Logger

use of ch.qos.logback.classic.Logger in project verify-hub by alphagov.

the class NotOnOrAfterLoggerTest method setUp.

@Before
public void setUp() throws Exception {
    final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    logger.addAppender(mockAppender);
    logger.setLevel(Level.INFO);
}
Also used : Logger(ch.qos.logback.classic.Logger) Before(org.junit.Before)

Example 53 with Logger

use of ch.qos.logback.classic.Logger in project verify-hub by alphagov.

the class UnknownMethodAlgorithmLoggerTest method tearDown.

@After
public void tearDown() throws Exception {
    final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    logger.detachAppender(mockAppender);
}
Also used : Logger(ch.qos.logback.classic.Logger) After(org.junit.After)

Example 54 with Logger

use of ch.qos.logback.classic.Logger in project springside4 by springside.

the class LogbackListAppender method removeFromRootLogger.

/**
 * 将此appender从root logger中移除.
 */
public void removeFromRootLogger() {
    Logger logger = (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    logger.detachAppender(this);
}
Also used : Logger(ch.qos.logback.classic.Logger)

Example 55 with Logger

use of ch.qos.logback.classic.Logger in project springside4 by springside.

the class LogbackListAppender method removeFromLogger.

/**
 * 将此appender从logger中移除.
 */
public void removeFromLogger(String loggerName) {
    Logger logger = (Logger) LoggerFactory.getLogger(loggerName);
    logger.detachAppender(this);
}
Also used : Logger(ch.qos.logback.classic.Logger)

Aggregations

Logger (ch.qos.logback.classic.Logger)144 Test (org.junit.Test)49 ILoggingEvent (ch.qos.logback.classic.spi.ILoggingEvent)45 LoggerContext (ch.qos.logback.classic.LoggerContext)40 FileAppender (ch.qos.logback.core.FileAppender)17 PatternLayoutEncoder (ch.qos.logback.classic.encoder.PatternLayoutEncoder)16 Appender (ch.qos.logback.core.Appender)16 File (java.io.File)13 ConsoleAppender (ch.qos.logback.core.ConsoleAppender)12 ArrayList (java.util.ArrayList)9 RollingFileAppender (ch.qos.logback.core.rolling.RollingFileAppender)8 AsyncLoggingEventAppenderFactory (io.dropwizard.logging.async.AsyncLoggingEventAppenderFactory)8 DropwizardLayoutFactory (io.dropwizard.logging.layout.DropwizardLayoutFactory)7 Before (org.junit.Before)7 PipeConfiguration (co.cask.cdap.filetailer.config.PipeConfiguration)6 Query (org.apache.lucene.search.Query)6 BaseIndexingTest (org.kie.workbench.common.services.refactoring.backend.server.BaseIndexingTest)6 SingleTermQueryBuilder (org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder)6 Level (ch.qos.logback.classic.Level)5 Map (java.util.Map)5