Package com.logicaldoc.util.config
Class LogConfigurator
java.lang.Object
com.logicaldoc.util.config.LogConfigurator
Utility class for manipulating log4j.xml file
- Author:
- Michael Scholz, Marco Meschieri
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addHtmlAppender
(String name) void
void
addTextAppender
(String name) This method selects all the appender namesSame asgetFile(String, boolean)
This method selects a filepath of an appender.Collection<org.jdom2.Element>
This method selects all the logger namesgetProperty
(String name) void
void
removeLogger
(String name) Removes a loggervoid
Adds or modifies a loggervoid
setLogsRoot
(String rootPath) Sets a common path for all file appenders.void
setRootLevel
(String level) boolean
write()
-
Constructor Details
-
LogConfigurator
public LogConfigurator()
-
-
Method Details
-
getProperty
-
getAppenders
This method selects all the appender names- Returns:
- collection of the log appender names
-
getLoggers
This method selects all the logger names- Returns:
- collection of the logger names
-
getFile
Same asgetFile(String, boolean)
- Parameters:
appender
- name of the appender- Returns:
- the path of the log file
-
getFile
This method selects a filepath of an appender.- Parameters:
appender
- The appender namereplaceVariables
- If true all variables(${var}) in the file path will be substituted- Returns:
- The log file path
-
addTextAppender
-
addHtmlAppender
-
addLogger
-
setLogger
Adds or modifies a logger- Parameters:
name
- the logger nameadditivity
- the additivity flaglevel
- the logger levelappenders
- optional list of appenders to assign
-
removeLogger
Removes a logger- Parameters:
name
- the logger name
-
getRootLevel
-
setRootLevel
-
setLogsRoot
Sets a common path for all file appenders.- Parameters:
rootPath
- The path to be used
-
getLogsRoot
-
write
public boolean write() -
initializeLogging
public void initializeLogging()
-