use of org.apache.logging.log4j.spi.LoggerContext in project logging-log4j2 by apache.
the class LogManagerTest method testShutdown.
@Test
public void testShutdown() {
final LoggerContext loggerContext = LogManager.getContext(false);
LogManager.shutdown(loggerContext);
}
use of org.apache.logging.log4j.spi.LoggerContext in project mule by mulesoft.
the class MessageProcessingFlowTraceManager method initialise.
@Override
public void initialise() throws InitialisationException {
LoggerContext context = LogManager.getContext(false);
if (context != null && context instanceof LogConfigChangeSubject) {
((LogConfigChangeSubject) context).registerLogConfigChangeListener(logConfigChangeListener);
}
handleNotificationListeners();
}
use of org.apache.logging.log4j.spi.LoggerContext in project mule by mulesoft.
the class MessageProcessingFlowTraceManager method dispose.
@Override
public void dispose() {
LoggerContext context = LogManager.getContext(false);
if (context != null && context instanceof LogConfigChangeSubject) {
((LogConfigChangeSubject) context).unregisterLogConfigChangeListener(logConfigChangeListener);
}
removeNotificationListeners();
}
use of org.apache.logging.log4j.spi.LoggerContext in project logging-log4j2 by apache.
the class Category method getParent.
public final Category getParent() {
if (!LogManager.isLog4jCorePresent()) {
return null;
}
final org.apache.logging.log4j.Logger parent = CategoryUtil.getParent(logger);
final LoggerContext loggerContext = CategoryUtil.getLoggerContext(logger);
if (parent == null || loggerContext == null) {
return null;
}
final ConcurrentMap<String, Logger> loggers = Hierarchy.getLoggersMap(loggerContext);
final Logger parentLogger = loggers.get(parent.getName());
return parentLogger == null ? new Category(parent) : parentLogger;
}
use of org.apache.logging.log4j.spi.LoggerContext in project logging-log4j2 by apache.
the class SimplePerfTest method workAroundLog4j2_5Bug.
private static void workAroundLog4j2_5Bug() {
// use reflection so we can use the same test with older versions of log4j2
try {
final Method setUseThreadLocals = AsyncLoggerContext.class.getDeclaredMethod("setUseThreadLocals", new Class[] { boolean.class });
final LoggerContext context = LogManager.getContext(false);
setUseThreadLocals.invoke(context, new Object[] { Boolean.TRUE });
} catch (final Throwable ignored) {
}
}
Aggregations