Class InternalLoggerRegistry
java.lang.Object
org.apache.logging.log4j.core.util.internal.InternalLoggerRegistry
A registry of
Loggers namespaced by name and message factory.
This class is internally used by LoggerContext.
We don't use the registry from Log4j API to keep Log4j Core independent from the version of Log4j API at runtime. This also allows Log4j Core to evolve independently from Log4j API.
- Since:
- 2.25.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputeIfAbsent(String name, MessageFactory messageFactory, BiFunction<String, MessageFactory, Logger> loggerSupplier) @Nullable LoggergetLogger(String name, MessageFactory messageFactory) Returns the logger associated with the given name and message factory.booleanhasLogger(String name, Class<? extends MessageFactory> messageFactoryClass) Checks if a logger associated with the given name and message factory type exists.booleanhasLogger(String name, MessageFactory messageFactory) Checks if a logger associated with the given name and message factory exists.
-
Constructor Details
-
InternalLoggerRegistry
public InternalLoggerRegistry()
-
-
Method Details
-
getLogger
Returns the logger associated with the given name and message factory.- Parameters:
name- a logger namemessageFactory- a message factory- Returns:
- the logger associated with the given name and message factory
-
getLoggers
-
hasLogger
Checks if a logger associated with the given name and message factory exists.- Parameters:
name- a logger namemessageFactory- a message factory- Returns:
true, if the logger exists;falseotherwise.
-
hasLogger
Checks if a logger associated with the given name and message factory type exists.- Parameters:
name- a logger namemessageFactoryClass- a message factory class- Returns:
true, if the logger exists;falseotherwise.
-
computeIfAbsent
public Logger computeIfAbsent(String name, MessageFactory messageFactory, BiFunction<String, MessageFactory, Logger> loggerSupplier)
-