Package org.swisspush.gateleen.logging
Class Log4jConfigurator
- java.lang.Object
-
- org.swisspush.gateleen.logging.Log4jConfigurator
-
public class Log4jConfigurator extends Object
Configurator used to configure a log4j repository dynamically.- Author:
- schwabmar
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getAppenders(String logger)Gets the appenders to a specific logger.org.apache.logging.log4j.LevelgetEffectiveLevel(String logger)Gets a logger's effective level thus either the direct level or the inherited level from it's parent logger.static Log4jConfiguratorgetInstance()Gets the one-and-only instance of the classLog4jConfigurator.org.apache.logging.log4j.LevelgetLevel(String logger)Gets a logger's actual level.List<String>getLoggers()Retrieves all loggers from the log4j repository.List<String>getLoggersSorted()Retrieves all loggers from the log4j repository.voidsetLoggerLevel(String name, String level)Sets or deletes a logger's new level.
-
-
-
Method Detail
-
getInstance
public static Log4jConfigurator getInstance()
Gets the one-and-only instance of the classLog4jConfigurator.- Returns:
- Instance.
-
getLoggers
public List<String> getLoggers()
Retrieves all loggers from the log4j repository.- Returns:
- List of
java.lang.Stringcontaining all logger names.
-
getLoggersSorted
public List<String> getLoggersSorted()
Retrieves all loggers from the log4j repository.- Returns:
- Sorted list of
java.lang.Stringcontaining all logger names.
-
getAppenders
public List<String> getAppenders(String logger) throws IllegalArgumentException
Gets the appenders to a specific logger.- Parameters:
logger- A logger's name.- Returns:
- List of
java.lang.Stringcontaining all appender names. - Throws:
IllegalArgumentException- In case the logger isn't known.
-
getLevel
public org.apache.logging.log4j.Level getLevel(String logger) throws IllegalArgumentException
Gets a logger's actual level.- Parameters:
logger- The logger.- Returns:
- The logger's level or
nullif no level was directly set on the logger. - Throws:
IllegalArgumentException- In case the logger isn't known.
-
getEffectiveLevel
public org.apache.logging.log4j.Level getEffectiveLevel(String logger) throws IllegalArgumentException
Gets a logger's effective level thus either the direct level or the inherited level from it's parent logger.- Parameters:
logger- The logger.- Returns:
- The logger's effective level.
- Throws:
IllegalArgumentException- In case the logger isn't known.
-
setLoggerLevel
public void setLoggerLevel(String name, String level) throws IllegalArgumentException
Sets or deletes a logger's new level.- Parameters:
name- Name of the logger to set.level- Level to set the logger to.- Throws:
IllegalArgumentException- In case the logger isn't known.
-
-