Package org.pentaho.platform.api.util
Class LogUtil
java.lang.Object
org.pentaho.platform.api.util.LogUtil
Various utility methods for working with log4j2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAppender
(org.apache.logging.log4j.core.Appender appender, org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level) Adds an appender to a logger creating a LoggerConfig if necessary so that the appender only listens to the specified logger and not parent loggers.static void
addAppender
(org.apache.logging.log4j.core.Appender appender, org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, org.apache.logging.log4j.core.Filter filter) static boolean
Returns true if the specific logger has been configured such as defined in log4j2.xmlgetAppenders
(org.apache.logging.log4j.Logger logger) static boolean
isAttached
(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.core.Appender appender) Returns true if appender is attached to logger.static org.apache.logging.log4j.core.Appender
makeAppender
(String name, StringWriter sw, String layout) static org.apache.logging.log4j.core.Appender
makeAppender
(String name, Writer writer, org.apache.logging.log4j.core.Filter filter, org.apache.logging.log4j.core.Layout layout) static org.apache.logging.log4j.core.Appender
makeAppender
(String name, Writer writer, org.apache.logging.log4j.core.Layout layout) static void
removeAppender
(org.apache.logging.log4j.core.Appender appender, org.apache.logging.log4j.Logger logger) static void
setLevel
(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level) Sets level of a logger creating a logger specific LoggerConfig if necessary.static void
setRootLoggerLevel
(org.apache.logging.log4j.Level level)
-
Constructor Details
-
LogUtil
public LogUtil()
-
-
Method Details
-
addAppender
public static void addAppender(org.apache.logging.log4j.core.Appender appender, org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level) Adds an appender to a logger creating a LoggerConfig if necessary so that the appender only listens to the specified logger and not parent loggers.- Parameters:
appender
-logger
-level
- - Set to null if appender should log all events
-
addAppender
public static void addAppender(org.apache.logging.log4j.core.Appender appender, org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, org.apache.logging.log4j.core.Filter filter) -
removeAppender
public static void removeAppender(org.apache.logging.log4j.core.Appender appender, org.apache.logging.log4j.Logger logger) -
makeAppender
public static org.apache.logging.log4j.core.Appender makeAppender(String name, StringWriter sw, String layout) -
makeAppender
-
makeAppender
-
setLevel
public static void setLevel(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level) Sets level of a logger creating a logger specific LoggerConfig if necessary.- Parameters:
logger
-level
-
-
setRootLoggerLevel
public static void setRootLoggerLevel(org.apache.logging.log4j.Level level) -
exists
Returns true if the specific logger has been configured such as defined in log4j2.xml- Parameters:
logger
-- Returns:
-
isAttached
public static boolean isAttached(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.core.Appender appender) Returns true if appender is attached to logger.- Parameters:
logger
-appender
-- Returns:
-
getAppenders
-