Class LogConfigurator

java.lang.Object
com.logicaldoc.util.config.LogConfigurator

public class LogConfigurator extends Object
Utility class for manipulating log4j.xml file
Author:
Michael Scholz, Marco Meschieri
  • Constructor Details

    • LogConfigurator

      public LogConfigurator()
  • Method Details

    • getProperty

      public String getProperty(String name)
    • getAppenders

      public Collection<String> getAppenders()
      This method selects all the appender names
      Returns:
      collection of the log appender names
    • getLoggers

      public Collection<org.jdom2.Element> getLoggers()
      This method selects all the logger names
      Returns:
      collection of the logger names
    • getFile

      public String getFile(String appender)
      Parameters:
      appender - name of the appender
      Returns:
      the path of the log file
    • getFile

      public String getFile(String appender, boolean replaceVariables)
      This method selects a filepath of an appender.
      Parameters:
      appender - The appender name
      replaceVariables - If true all variables(${var}) in the file path will be substituted
      Returns:
      The log file path
    • addTextAppender

      public void addTextAppender(String name)
    • addHtmlAppender

      public void addHtmlAppender(String name)
    • addLogger

      public void addLogger(String name, List<String> appenders)
    • setLogger

      public void setLogger(String name, boolean additivity, String level, List<String> appenders)
      Adds or modifies a logger
      Parameters:
      name - the logger name
      additivity - the additivity flag
      level - the logger level
      appenders - optional list of appenders to assign
    • removeLogger

      public void removeLogger(String name)
      Removes a logger
      Parameters:
      name - the logger name
    • getRootLevel

      public String getRootLevel()
    • setRootLevel

      public void setRootLevel(String level)
    • setLogsRoot

      public void setLogsRoot(String rootPath)
      Sets a common path for all file appenders.
      Parameters:
      rootPath - The path to be used
    • getLogsRoot

      public String getLogsRoot()
    • write

      public boolean write()
    • initializeLogging

      public void initializeLogging()