Package org.apache.logging.log4j.util
Class ProviderUtil
- java.lang.Object
-
- org.apache.logging.log4j.util.ProviderUtil
-
public final class ProviderUtil extends java.lang.ObjectConsider this class private. Utility class for Log4jProviders. When integrating with an application container framework, any Log4j Providers not accessible through standard classpath scanning shouldloadProvider(java.net.URL, ClassLoader)a classpath accordingly.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringAPI_VERSIONprivate static java.lang.String[]COMPATIBLE_API_VERSIONSprivate static ProviderUtilinstanceprivate static LoggerLOGGERprotected static java.lang.StringPROVIDER_RESOURCEResource name for a Log4j 2 provider properties file.protected static java.util.Collection<Provider>PROVIDERSLoaded providers.protected static java.util.concurrent.locks.LockSTARTUP_LOCKGuards the ProviderUtil singleton instance from lazy initialization.
-
Constructor Summary
Constructors Modifier Constructor Description privateProviderUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static voidaddProvider(Provider provider)static java.lang.ClassLoaderfindClassLoader()static java.lang.Iterable<Provider>getProviders()static booleanhasProviders()protected static voidlazyInit()Lazily initializes the ProviderUtil singleton.protected static voidloadProvider(java.net.URL url, java.lang.ClassLoader cl)Loads an individual Provider implementation.protected static voidloadProviders(java.lang.ClassLoader classLoader)protected static voidloadProviders(java.util.Enumeration<java.net.URL> urls, java.lang.ClassLoader cl)Deprecated.UseloadProvider(java.net.URL, ClassLoader)instead.private static booleanvalidVersion(java.lang.String version)
-
-
-
Field Detail
-
PROVIDER_RESOURCE
protected static final java.lang.String PROVIDER_RESOURCE
Resource name for a Log4j 2 provider properties file.- See Also:
- Constant Field Values
-
PROVIDERS
protected static final java.util.Collection<Provider> PROVIDERS
Loaded providers.
-
STARTUP_LOCK
protected static final java.util.concurrent.locks.Lock STARTUP_LOCK
Guards the ProviderUtil singleton instance from lazy initialization. This is primarily used for OSGi support.- Since:
- 2.1
-
API_VERSION
private static final java.lang.String API_VERSION
- See Also:
- Constant Field Values
-
COMPATIBLE_API_VERSIONS
private static final java.lang.String[] COMPATIBLE_API_VERSIONS
-
LOGGER
private static final Logger LOGGER
-
instance
private static volatile ProviderUtil instance
-
-
Method Detail
-
addProvider
protected static void addProvider(Provider provider)
-
loadProvider
protected static void loadProvider(java.net.URL url, java.lang.ClassLoader cl)Loads an individual Provider implementation. This method is really only useful for the OSGi bundle activator and this class itself.- Parameters:
url- the URL to the provider properties filecl- the ClassLoader to load the provider classes with
-
loadProviders
protected static void loadProviders(java.lang.ClassLoader classLoader)
- Parameters:
classLoader- null can be used to mark the bootstrap class loader.
-
loadProviders
@Deprecated protected static void loadProviders(java.util.Enumeration<java.net.URL> urls, java.lang.ClassLoader cl)Deprecated.UseloadProvider(java.net.URL, ClassLoader)instead. Will be removed in 3.0.
-
getProviders
public static java.lang.Iterable<Provider> getProviders()
-
hasProviders
public static boolean hasProviders()
-
lazyInit
protected static void lazyInit()
Lazily initializes the ProviderUtil singleton.- Since:
- 2.1
-
findClassLoader
public static java.lang.ClassLoader findClassLoader()
-
validVersion
private static boolean validVersion(java.lang.String version)
-
-