Search in sources :

Example 36 with LoggerContext

use of ch.qos.logback.classic.LoggerContext in project sonarqube by SonarSource.

the class CeProcessLoggingTest method configure_defines_hardcoded_levels_unchanged_by_global_property.

@Test
public void configure_defines_hardcoded_levels_unchanged_by_global_property() {
    props.set("sonar.log.level", "TRACE");
    LoggerContext context = underTest.configure(props);
    verifyImmutableLogLevels(context);
}
Also used : LoggerContext(ch.qos.logback.classic.LoggerContext) Test(org.junit.Test)

Example 37 with LoggerContext

use of ch.qos.logback.classic.LoggerContext in project sonarqube by SonarSource.

the class CeProcessLoggingTest method sql_logger_level_changes_with_global_property_and_is_case_insensitive.

@Test
public void sql_logger_level_changes_with_global_property_and_is_case_insensitive() {
    props.set("sonar.log.level", "InFO");
    LoggerContext ctx = underTest.configure(props);
    verifySqlLogLevel(ctx, Level.INFO);
}
Also used : LoggerContext(ch.qos.logback.classic.LoggerContext) Test(org.junit.Test)

Example 38 with LoggerContext

use of ch.qos.logback.classic.LoggerContext in project sonarqube by SonarSource.

the class CeProcessLoggingTest method jmx_logger_level_changes_with_ce_jmx_property_and_is_case_insensitive.

@Test
public void jmx_logger_level_changes_with_ce_jmx_property_and_is_case_insensitive() {
    props.set("sonar.log.level.ce.jmx", "debug");
    LoggerContext ctx = underTest.configure(props);
    verifyJmxLogLevel(ctx, Level.DEBUG);
}
Also used : LoggerContext(ch.qos.logback.classic.LoggerContext) Test(org.junit.Test)

Example 39 with LoggerContext

use of ch.qos.logback.classic.LoggerContext in project sonarqube by SonarSource.

the class WebServerProcessLoggingTest method sql_logger_level_is_configured_from_web_sql_property_over_global_property.

@Test
public void sql_logger_level_is_configured_from_web_sql_property_over_global_property() {
    props.set("sonar.log.level.web.sql", "debug");
    props.set("sonar.log.level", "TRACE");
    LoggerContext ctx = underTest.configure(props);
    verifySqlLogLevel(ctx, Level.DEBUG);
}
Also used : LoggerContext(ch.qos.logback.classic.LoggerContext) Test(org.junit.Test)

Example 40 with LoggerContext

use of ch.qos.logback.classic.LoggerContext in project sonarqube by SonarSource.

the class WebServerProcessLoggingTest method startup_logger_prints_to_only_to_system_out.

@Test
public void startup_logger_prints_to_only_to_system_out() {
    LoggerContext ctx = underTest.configure(props);
    Logger startup = ctx.getLogger("startup");
    assertThat(startup.isAdditive()).isFalse();
    Appender appender = startup.getAppender("CONSOLE");
    assertThat(appender).isInstanceOf(ConsoleAppender.class);
    ConsoleAppender<ILoggingEvent> consoleAppender = (ConsoleAppender<ILoggingEvent>) appender;
    assertThat(consoleAppender.getTarget()).isEqualTo("System.out");
    assertThat(consoleAppender.getEncoder()).isInstanceOf(PatternLayoutEncoder.class);
    PatternLayoutEncoder patternEncoder = (PatternLayoutEncoder) consoleAppender.getEncoder();
    assertThat(patternEncoder.getPattern()).isEqualTo("%d{yyyy.MM.dd HH:mm:ss} %-5level app[][%logger{20}] %msg%n");
}
Also used : ConsoleAppender(ch.qos.logback.core.ConsoleAppender) FileAppender(ch.qos.logback.core.FileAppender) Appender(ch.qos.logback.core.Appender) ConsoleAppender(ch.qos.logback.core.ConsoleAppender) PatternLayoutEncoder(ch.qos.logback.classic.encoder.PatternLayoutEncoder) Logger(ch.qos.logback.classic.Logger) ILoggingEvent(ch.qos.logback.classic.spi.ILoggingEvent) LoggerContext(ch.qos.logback.classic.LoggerContext) Test(org.junit.Test)

Aggregations

LoggerContext (ch.qos.logback.classic.LoggerContext)200 Test (org.junit.Test)133 Logger (ch.qos.logback.classic.Logger)39 ILoggingEvent (ch.qos.logback.classic.spi.ILoggingEvent)39 PatternLayoutEncoder (ch.qos.logback.classic.encoder.PatternLayoutEncoder)21 FileAppender (ch.qos.logback.core.FileAppender)19 File (java.io.File)18 JoranConfigurator (ch.qos.logback.classic.joran.JoranConfigurator)15 RollingFileAppender (ch.qos.logback.core.rolling.RollingFileAppender)15 Appender (ch.qos.logback.core.Appender)14 NullLevelFilterFactory (io.dropwizard.logging.filter.NullLevelFilterFactory)13 ConsoleAppender (ch.qos.logback.core.ConsoleAppender)12 AsyncLoggingEventAppenderFactory (io.dropwizard.logging.async.AsyncLoggingEventAppenderFactory)12 AsyncAppender (ch.qos.logback.classic.AsyncAppender)11 DropwizardLayoutFactory (io.dropwizard.logging.layout.DropwizardLayoutFactory)11 JoranException (ch.qos.logback.core.joran.spi.JoranException)10 IOException (java.io.IOException)7 Logger (org.slf4j.Logger)7 TimeBasedRollingPolicy (ch.qos.logback.core.rolling.TimeBasedRollingPolicy)6 ArrayList (java.util.ArrayList)6