Class Log4jIntegrationConfig
- java.lang.Object
-
- org.arakhne.afc.bootique.log4j.configs.Log4jIntegrationConfig
-
public class Log4jIntegrationConfig extends Object
Configuration for log4j over SLF4J.- Since:
- 15.0
- Version:
- 17.0 2020-01-04 14:41:57
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.bootique
- Maven Artifact Id:
- bootique-log4j
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_LOG_FORMATDefault conversion pattern for the logger.static StringLEVELName of the property that contains the logging level.static StringLOG_FORMATName of the property that contains the log format.static StringPREFIXPrefix for the configuration entries of the log4j modules.static StringUSE_LOG4J_CONFIGName of the property that indicates if the log4j configuration must be used for initializing the loggers.
-
Constructor Summary
Constructors Constructor Description Log4jIntegrationConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.log4j.LoggerconfigureLogger(String loggerName)Configure the given logger from the configuration.org.apache.log4j.LoggerconfigureLogger(org.apache.log4j.Logger logger)Configure the given logger from the configuration.List<AppenderConfig>getAppenders()Replies the appenders' configurations.static Log4jIntegrationConfiggetConfiguration(io.bootique.config.ConfigurationFactory configFactory)Replies the configuration factory for the logging.LevelgetLevel()Replies the level.StringgetLogFormat()Replies the format of the log.booleangetUseLog4jConfig()Replies if the configuration should be used for configuring the Log4j loggers.voidsetAppenders(List<AppenderConfig> configs)Change the appenders' configurations.voidsetLevel(Level level)Change the level.voidsetLogFormat(String format)Change the format of the log.voidsetUseLog4jConfig(boolean use)Change the flag that indicates if the configuration should be used for configuring the Log4j loggers.
-
-
-
Field Detail
-
PREFIX
public static final String PREFIX
Prefix for the configuration entries of the log4j modules.- See Also:
- Constant Field Values
-
LEVEL
public static final String LEVEL
Name of the property that contains the logging level.- See Also:
- Constant Field Values
-
USE_LOG4J_CONFIG
public static final String USE_LOG4J_CONFIG
Name of the property that indicates if the log4j configuration must be used for initializing the loggers.- See Also:
- Constant Field Values
-
LOG_FORMAT
public static final String LOG_FORMAT
Name of the property that contains the log format.- See Also:
- Constant Field Values
-
DEFAULT_LOG_FORMAT
public static final String DEFAULT_LOG_FORMAT
Default conversion pattern for the logger.- See Also:
- Constant Field Values
-
-
Method Detail
-
getConfiguration
public static Log4jIntegrationConfig getConfiguration(io.bootique.config.ConfigurationFactory configFactory)
Replies the configuration factory for the logging.- Parameters:
configFactory- the general configuration factory.- Returns:
- the logging configuration factory.
-
getAppenders
public List<AppenderConfig> getAppenders()
Replies the appenders' configurations.- Returns:
- the appenders' configurations.
-
setAppenders
public void setAppenders(List<AppenderConfig> configs)
Change the appenders' configurations.- Parameters:
configs- the appenders' configurations.
-
getLevel
public Level getLevel()
Replies the level.- Returns:
- the level.
-
setLevel
public void setLevel(Level level)
Change the level.- Parameters:
level- the level.
-
configureLogger
public org.apache.log4j.Logger configureLogger(org.apache.log4j.Logger logger)
Configure the given logger from the configuration.- Parameters:
logger- the logger to configure.- Returns:
- the logger.
-
configureLogger
public org.apache.log4j.Logger configureLogger(String loggerName)
Configure the given logger from the configuration.- Parameters:
loggerName- the name of the logger to configure.- Returns:
- the logger.
-
getUseLog4jConfig
public boolean getUseLog4jConfig()
Replies if the configuration should be used for configuring the Log4j loggers.- Returns:
truefor using the configuration.
-
setUseLog4jConfig
public void setUseLog4jConfig(boolean use)
Change the flag that indicates if the configuration should be used for configuring the Log4j loggers.- Parameters:
use-truefor using the configuration.
-
getLogFormat
public String getLogFormat()
Replies the format of the log.- Returns:
- the format, never
null.
-
setLogFormat
public void setLogFormat(String format)
Change the format of the log.- Parameters:
format- the format.
-
-