Class Provider

  • Direct Known Subclasses:
    Log4jProvider, SLF4JProvider

    public class Provider
    extends java.lang.Object
    Model class for a Log4j 2 provider. The properties in this class correspond to the properties used in a META-INF/log4j-provider.properties file. Note that this class is automatically created by Log4j and should not be used by providers.
    • Field Detail

      • FACTORY_PRIORITY

        public static final java.lang.String FACTORY_PRIORITY
        Property name to set for a Log4j 2 provider to specify the priority of this implementation.
        See Also:
        Constant Field Values
      • DEFAULT_PRIORITY

        private static final java.lang.Integer DEFAULT_PRIORITY
      • LOGGER

        private static final Logger LOGGER
      • priority

        private final java.lang.Integer priority
      • className

        private final java.lang.String className
      • loggerContextFactoryClass

        private final java.lang.Class<? extends LoggerContextFactory> loggerContextFactoryClass
      • threadContextMap

        private final java.lang.String threadContextMap
      • threadContextMapClass

        private final java.lang.Class<? extends ThreadContextMap> threadContextMapClass
      • versions

        private final java.lang.String versions
      • url

        private final java.net.URL url
      • classLoader

        private final java.lang.ref.WeakReference<java.lang.ClassLoader> classLoader
    • Constructor Detail

      • Provider

        public Provider​(java.util.Properties props,
                        java.net.URL url,
                        java.lang.ClassLoader classLoader)
      • Provider

        public Provider​(java.lang.Integer priority,
                        java.lang.String versions,
                        java.lang.Class<? extends LoggerContextFactory> loggerContextFactoryClass)
      • Provider

        public Provider​(java.lang.Integer priority,
                        java.lang.String versions,
                        java.lang.Class<? extends LoggerContextFactory> loggerContextFactoryClass,
                        java.lang.Class<? extends ThreadContextMap> threadContextMapClass)
    • Method Detail

      • getVersions

        public java.lang.String getVersions()
        Returns the Log4j API versions supported by the implementation.
        Returns:
        A String containing the Log4j versions supported.
      • getPriority

        public java.lang.Integer getPriority()
        Gets the priority (natural ordering) of this Provider.
        Returns:
        the priority of this Provider
      • getClassName

        public java.lang.String getClassName()
        Gets the class name of the LoggerContextFactory implementation of this Provider.
        Returns:
        the class name of a LoggerContextFactory implementation
      • loadLoggerContextFactory

        public java.lang.Class<? extends LoggerContextFactory> loadLoggerContextFactory()
        Loads the LoggerContextFactory class specified by this Provider.
        Returns:
        the LoggerContextFactory implementation class or null if there was an error loading it
      • getThreadContextMap

        public java.lang.String getThreadContextMap()
        Gets the class name of the ThreadContextMap implementation of this Provider.
        Returns:
        the class name of a ThreadContextMap implementation
      • loadThreadContextMap

        public java.lang.Class<? extends ThreadContextMap> loadThreadContextMap()
        Loads the ThreadContextMap class specified by this Provider.
        Returns:
        the ThreadContextMap implementation class or null if there was an error loading it
      • getUrl

        public java.net.URL getUrl()
        Gets the URL containing this Provider's Log4j details.
        Returns:
        the URL corresponding to the Provider META-INF/log4j-provider.properties file
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object