Class MLClassLoaderContextSelector

java.lang.Object
org.apache.logging.log4j.core.selector.ClassLoaderContextSelector
cpw.mods.modlauncher.log.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, LOGGER

    Fields inherited from interface org.apache.logging.log4j.core.selector.ContextSelector

    DEFAULT_STOP_TIMEOUT
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
     

    Methods inherited from class org.apache.logging.log4j.core.selector.ClassLoaderContextSelector

    contextShutdown, createContext, defaultContextName, getContext, getContext, getContext, getDefault, getLoggerContexts, hasContext, isClassLoaderDependent, removeContext, shutdown

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.logging.log4j.core.selector.ContextSelector

    getContext
  • Constructor Details

    • MLClassLoaderContextSelector

      public MLClassLoaderContextSelector()
  • Method Details

    • toContextMapKey

      protected String toContextMapKey(ClassLoader loader)
      Overrides:
      toContextMapKey in class org.apache.logging.log4j.core.selector.ClassLoaderContextSelector