public class MuleLog4jContextFactory
extends org.apache.logging.log4j.core.impl.Log4jContextFactory
implements org.mule.runtime.api.lifecycle.Disposable, org.apache.logging.log4j.core.util.ShutdownCallbackRegistry
LoggerContextFactory which acts as the bootstrap for mule's logging mechanism.
It forces ArtifactAwareContextSelector as the only selector, XmlConfigurationFactory as the only available
ConfigurationFactory, and sets AsyncLoggerExceptionHandler as the ExceptionHandler for failing async
loggers.
Other than that, it's pretty much a copy paste of Log4jContextFactory, due to that classes' lack of extensibility.
By forcing XmlConfigurationFactory as the only available ConfigurationFactory we're disabling log4j2's ability
to take json and yaml configurations. This is so because those configuration factories depend on versions of the jackson
libraries which would cause conflict with the ones in mule. TODO: Upgrade the jackson libraries bundled with mule so that this
restriction can be lifted off
This class also implements ShutdownCallbackRegistry to avoid default behaviour which is| Modifier and Type | Field and Description |
|---|---|
static boolean |
LOG_SEPARATION_ENABLED |
| Constructor and Description |
|---|
MuleLog4jContextFactory()
Initializes using a
ArtifactAwareContextSelector |
MuleLog4jContextFactory(boolean logSeparationEnabled)
Initializes using a
ArtifactAwareContextSelector |
MuleLog4jContextFactory(org.apache.logging.log4j.core.selector.ContextSelector contextSelector)
Initializes using
contextSelector |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
protected void |
initialise() |
addShutdownCallback, getContext, getContext, getContext, getContext, getContext, getSelector, getShutdownCallbackRegistry, hasContext, isShutdownHookEnabled, removeContext, shutdownpublic MuleLog4jContextFactory()
ArtifactAwareContextSelector
Log4j tries to instantiate this class using a default constructor.
public MuleLog4jContextFactory(boolean logSeparationEnabled)
ArtifactAwareContextSelectorpublic MuleLog4jContextFactory(org.apache.logging.log4j.core.selector.ContextSelector contextSelector)
contextSelectorcontextSelector - a ContextSelectorCopyright © 2003–2021 MuleSoft, Inc.. All rights reserved.