use of ch.qos.logback.classic.Logger in project sonarqube by SonarSource.
the class WebServerProcessLoggingTest method verifyRootLogLevel.
private void verifyRootLogLevel(LoggerContext ctx, Level expected) {
Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
assertThat(rootLogger.getLevel()).isEqualTo(expected);
}
use of ch.qos.logback.classic.Logger in project sonarqube by SonarSource.
the class WebServerProcessLoggingTest method do_not_log_to_console.
@Test
public void do_not_log_to_console() {
LoggerContext ctx = underTest.configure(props);
Logger root = ctx.getLogger(Logger.ROOT_LOGGER_NAME);
Appender appender = root.getAppender("CONSOLE");
assertThat(appender).isNull();
}
use of ch.qos.logback.classic.Logger in project sonarqube by SonarSource.
the class CeProcessLoggingTest method log_to_ce_file.
@Test
public void log_to_ce_file() {
LoggerContext ctx = underTest.configure(props);
Logger root = ctx.getLogger(Logger.ROOT_LOGGER_NAME);
Appender<ILoggingEvent> appender = root.getAppender("file_ce");
assertThat(appender).isInstanceOf(FileAppender.class);
FileAppender fileAppender = (FileAppender) appender;
assertThat(fileAppender.getFile()).isEqualTo(new File(logDir, "ce.log").getAbsolutePath());
assertThat(fileAppender.getEncoder()).isInstanceOf(PatternLayoutEncoder.class);
PatternLayoutEncoder encoder = (PatternLayoutEncoder) fileAppender.getEncoder();
assertThat(encoder.getPattern()).isEqualTo("%d{yyyy.MM.dd HH:mm:ss} %-5level ce[%X{ceTaskUuid}][%logger{20}] %msg%n");
}
use of ch.qos.logback.classic.Logger in project sonarqube by SonarSource.
the class CeProcessLoggingTest method do_not_log_to_console.
@Test
public void do_not_log_to_console() {
LoggerContext ctx = underTest.configure(props);
Logger root = ctx.getLogger(Logger.ROOT_LOGGER_NAME);
Appender appender = root.getAppender("CONSOLE");
assertThat(appender).isNull();
}
use of ch.qos.logback.classic.Logger in project sonarqube by SonarSource.
the class AppLogging method configureGobbler.
/**
* Configure the logger to which logs from sub processes are written to
* (called {@link StreamGobbler#LOGGER_GOBBLER}) by {@link StreamGobbler},
* to be:
* <ol>
* <li>non additive (ie. these logs will be output by the appender of {@link StreamGobbler#LOGGER_GOBBLER} and only this one)</li>
* <li>write logs as is (ie. without any extra formatting)</li>
* <li>write exclusively to App's System.out</li>
* </ol>
*/
private void configureGobbler(LoggerContext ctx) {
Logger gobblerLogger = ctx.getLogger(LOGGER_GOBBLER);
gobblerLogger.setAdditive(false);
gobblerLogger.addAppender(helper.newConsoleAppender(ctx, GOBBLER_PLAIN_CONSOLE, "%msg%n"));
}
Aggregations