use of org.apache.logging.log4j.core.LoggerContext in project elasticsearch by elastic.
the class EvilLoggerConfigurationTests method tearDown.
@Override
public void tearDown() throws Exception {
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Configurator.shutdown(context);
super.tearDown();
}
use of org.apache.logging.log4j.core.LoggerContext in project cryptomator by cryptomator.
the class DebugMode method enable.
private void enable() {
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Configuration config = context.getConfiguration();
LOGGER_UPGRADES.forEach(loggerUpgrade -> loggerUpgrade.execute(config));
context.updateLoggers();
}
use of org.apache.logging.log4j.core.LoggerContext in project torodb by torodb.
the class Log4jUtils method setRootLevel.
public static void setRootLevel(LogLevel logLevel) {
LoggerContext coreContext = (LoggerContext) LogManager.getContext(false);
Configuration configuration = coreContext.getConfiguration();
for (LoggerConfig loggerConfig : configuration.getLoggers().values()) {
setLevel(loggerConfig, logLevel);
}
}
use of org.apache.logging.log4j.core.LoggerContext in project graylog2-server by Graylog2.
the class CmdLineTool method initializeLogging.
private void initializeLogging(final Level logLevel) {
final LoggerContext context = (LoggerContext) LogManager.getContext(false);
final org.apache.logging.log4j.core.config.Configuration config = context.getConfiguration();
config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(logLevel);
config.getLoggerConfig(Main.class.getPackage().getName()).setLevel(logLevel);
context.updateLoggers(config);
}
use of org.apache.logging.log4j.core.LoggerContext in project graylog2-server by Graylog2.
the class LoggersResource method getLoggerConfigs.
@VisibleForTesting
protected Collection<LoggerConfig> getLoggerConfigs() {
final LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false);
final Configuration configuration = loggerContext.getConfiguration();
return configuration.getLoggers().values();
}
Aggregations