Package org.apache.log4j.legacy.core
Class CategoryUtil
java.lang.Object
org.apache.log4j.legacy.core.CategoryUtil
Delegates to
Logger methods implemented by log4j-core if appropriate.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAppender(Logger logger, Appender appender) Adds an appender to the logger.private static Loggerprivate static <T> TgetAppenders(Logger logger) Gets the appenders attached directly to this logger.getDirectAppenders(Logger logger) private static Optional<LoggerConfig> getExactLoggerConfig(Logger logger) getFilters(Logger logger) Delegates toLogger.getFilters()if appropriate.static LoggerContextgetLoggerContext(Logger logger) Delegates toLogger.getContext()if appropriate.static LoggerDelegates toLogger.getParent()if appropriate.static booleanisAdditive(Logger logger) Delegates toLogger.isAdditive()if appropriate.private static booleanstatic voidSends the event to all appenders directly connected with the logger.static voidsetAdditivity(Logger logger, boolean additive) Delegates toLogger.setAdditive(boolean)if appropriate.static voidDelegates toLogger.setLevel(Level)if appropriate.
-
Constructor Details
-
CategoryUtil
private CategoryUtil()
-
-
Method Details
-
asCore
-
get
-
getAppenders
Gets the appenders attached directly to this logger.- Parameters:
logger- The target logger.- Returns:
- A Map containing the Appender's name as the key and the Appender as the value.
-
getDirectAppenders
-
getExactLoggerConfig
-
getFilters
Delegates toLogger.getFilters()if appropriate.- Parameters:
logger- The target logger.- Returns:
- An Iterator over all the Filters associated with the Logger.
-
getLoggerContext
Delegates toLogger.getContext()if appropriate.- Parameters:
logger- The target logger.- Returns:
- the LoggerContext.
-
getParent
Delegates toLogger.getParent()if appropriate.- Parameters:
logger- The target logger.- Returns:
- The parent Logger.
-
isAdditive
Delegates toLogger.isAdditive()if appropriate.- Parameters:
logger- The target logger.- Returns:
- true if the associated LoggerConfig is additive, false otherwise.
-
isCore
-
setAdditivity
Delegates toLogger.setAdditive(boolean)if appropriate.- Parameters:
logger- The target logger.additive- Boolean value to indicate whether the Logger is additive or not.
-
setLevel
Delegates toLogger.setLevel(Level)if appropriate.- Parameters:
logger- The target logger.level- The Level to use on this Logger, may be null.
-
addAppender
Adds an appender to the logger. This method requires a check for the presence of Log4j Core or it will cause aClassNotFoundException.- Parameters:
logger- The target logger.appender- A Log4j2 appender.
-
log
Sends the event to all appenders directly connected with the logger. This method requires a check for the presence of Log4j Core or it will cause aClassNotFoundException.- Parameters:
logger- The target logger.event- The event to send.
-