Class InternalLoggerRegistry
- java.lang.Object
-
- org.apache.logging.log4j.core.util.internal.InternalLoggerRegistry
-
@NullMarked public final class InternalLoggerRegistry extends Object
A registry ofLoggers namespaced by name and message factory. This class is internally used byLoggerContext.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 Constructor Description InternalLoggerRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoggercomputeIfAbsent(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.Collection<Logger>getLoggers()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.
-
-
-
Method Detail
-
getLogger
public @Nullable Logger getLogger(String name, MessageFactory messageFactory)
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
public Collection<Logger> getLoggers()
-
hasLogger
public boolean hasLogger(String name, MessageFactory messageFactory)
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
public boolean hasLogger(String name, Class<? extends MessageFactory> messageFactoryClass)
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)
-
-