Package net.neoforged.fml.logging
Class MLClassLoaderContextSelector
java.lang.Object
org.apache.logging.log4j.core.selector.ClassLoaderContextSelector
net.neoforged.fml.logging.MLClassLoaderContextSelector
- All Implemented Interfaces:
org.apache.logging.log4j.core.selector.ContextSelector,org.apache.logging.log4j.spi.LoggerContextShutdownAware
public class MLClassLoaderContextSelector
extends org.apache.logging.log4j.core.selector.ClassLoaderContextSelector
A custom context selector to avoid initializing multiple log4j contexts due to
ClassLoader.getParent() always returning null (as a ModuleClassLoader can have multiple parents).
As all ModuleClassLoaders should get the same log4j context, we just return a static string with "MCL", otherwise we use the default logic-
Field Summary
Fields inherited from class org.apache.logging.log4j.core.selector.ClassLoaderContextSelector
CONTEXT_MAP, LOGGERFields inherited from interface org.apache.logging.log4j.core.selector.ContextSelector
DEFAULT_STOP_TIMEOUT -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.logging.log4j.core.selector.ClassLoaderContextSelector
contextShutdown, createContext, defaultContextName, getContext, getContext, getContext, getDefault, getLoggerContexts, hasContext, isClassLoaderDependent, removeContext, shutdownMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.logging.log4j.core.selector.ContextSelector
getContext
-
Constructor Details
-
MLClassLoaderContextSelector
public MLClassLoaderContextSelector()
-
-
Method Details
-
toContextMapKey
- Overrides:
toContextMapKeyin classorg.apache.logging.log4j.core.selector.ClassLoaderContextSelector
-