use of ch.qos.logback.classic.Logger in project helios by spotify.
the class CliMain method setupLogging.
private void setupLogging() {
final LoggingConfig config = parser.getLoggingConfig();
if (config.getNoLogSetup()) {
return;
}
final int verbose = config.getVerbosity();
final Level level = get(asList(WARN, INFO, DEBUG, ALL), verbose, ALL);
final Logger rootLogger = (Logger) LoggerFactory.getLogger(ROOT_LOGGER_NAME);
rootLogger.setLevel(level);
}
use of ch.qos.logback.classic.Logger in project spring-boot by spring-projects.
the class LogbackLoggingSystemTests method systemLevelTraceShouldReturnNativeLevelTraceNotAll.
@Test
public void systemLevelTraceShouldReturnNativeLevelTraceNotAll() throws Exception {
this.loggingSystem.beforeInitialize();
this.loggingSystem.initialize(this.initializationContext, null, null);
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.TRACE);
Logger logger = this.loggingSystem.getLogger(getClass().getName());
assertThat(logger.getLevel()).isEqualTo(Level.TRACE);
}
use of ch.qos.logback.classic.Logger in project spring-boot by spring-projects.
the class LogbackLoggingSystemTests method getLoggingConfigurationForALL.
@Test
public void getLoggingConfigurationForALL() throws Exception {
this.loggingSystem.beforeInitialize();
this.loggingSystem.initialize(this.initializationContext, null, null);
Logger logger = this.loggingSystem.getLogger(getClass().getName());
logger.setLevel(Level.ALL);
LoggerConfiguration configuration = this.loggingSystem.getLoggerConfiguration(getClass().getName());
assertThat(configuration).isEqualTo(new LoggerConfiguration(getClass().getName(), LogLevel.TRACE, LogLevel.TRACE));
}
use of ch.qos.logback.classic.Logger in project spring-boot by spring-projects.
the class LogbackLoggingSystemTests method testBasicConfigLocation.
@Test
public void testBasicConfigLocation() throws Exception {
this.loggingSystem.beforeInitialize();
ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
LoggerContext context = (LoggerContext) factory;
Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
assertThat(root.getAppender("CONSOLE")).isNotNull();
}
use of ch.qos.logback.classic.Logger in project sonarqube by SonarSource.
the class CeProcessLoggingTest 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");
}
Aggregations