Package org.pentaho.platform.api.util
Class LogUtil
- java.lang.Object
-
- org.pentaho.platform.api.util.LogUtil
-
public class LogUtil extends Object
Various utility methods for working with log4j2
-
-
Constructor Summary
Constructors Constructor Description LogUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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
exists(String logger)
Returns true if the specific logger has been configured such as defined in log4j2.xmlstatic Map<String,org.apache.logging.log4j.core.Appender>
getAppenders(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)
-
-
-
Method Detail
-
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
public static org.apache.logging.log4j.core.Appender makeAppender(String name, Writer writer, org.apache.logging.log4j.core.Layout layout)
-
makeAppender
public 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)
-
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
public static boolean exists(String logger)
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:
-
-