Implementation of {@link org.apache.logging.log4j.core.selector.ContextSelector}which is used to implement log separation based on provided or current {@link java.lang.ClassLoader}
This component is responsible for managing the {@link org.apache.logging.log4j.core.LoggerContext}that corresponds to each artifact (aka applications, domains, container), using its classloader as an identifier. The same classloader always gets the same {@link org.apache.logging.log4j.core.LoggerContext}
This component also overrides log4j2's default algorithm for locating configuration files, although it does it in a way consistent with the replaced behavior:
- A file called log4j2-test.xml is fetched from the corresponding search path
- If log4j2-test.xml is not found, then log4j2.xml is attempted
- If not found, a default configuration consisting of a single rolling file appender is used
- The search path is derived from the artifact for which a logging context is being requested, following a child first strategy (artifact - domain - container). Each artifact starts looking in the phase that makes sense for it
If the classloader is an artifact one, then it adds a {@link org.mule.module.launcher.artifact.ShutdownListener}to destroy the logging context when the app is undeployed, preventing memory leaks.
If mule is running in embedded mode, then all of this logic described above is discarded and it simply logs to a file called mule-main.log
@since 3.6.0