Class ProviderUtil

  • public final class ProviderUtil
    extends Object
    Consider this class private. Utility class for Log4j Providers. When integrating with an application container framework, any Log4j Providers not accessible through standard classpath scanning should loadProvider(, ClassLoader) a classpath accordingly.
    • Field Detail


        protected static final String PROVIDER_RESOURCE
        Resource name for a Log4j 2 provider properties file.
        See Also:
        Constant Field Values

        protected static final Lock STARTUP_LOCK
        Guards the ProviderUtil singleton instance from lazy initialization. This is primarily used for OSGi support.
    • Method Detail

      • addProvider

        protected static void addProvider​(Provider provider)
      • loadProvider

        protected static void loadProvider​(URL url,
                                           ClassLoader cl)
        Loads an individual Provider implementation. This method is really only useful for the OSGi bundle activator and this class itself.
        url - the URL to the provider properties file
        cl - the ClassLoader to load the provider classes with
      • loadProviders

        protected static void loadProviders​(ClassLoader classLoader)
        classLoader - null can be used to mark the bootstrap class loader.
      • hasProviders

        public static boolean hasProviders()
      • lazyInit

        protected static void lazyInit()
        Lazily initializes the ProviderUtil singleton.
      • findClassLoader

        public static ClassLoader findClassLoader()