Class Log4j1ConfigurationParser

java.lang.Object
org.apache.log4j.config.Log4j1ConfigurationParser

public class Log4j1ConfigurationParser extends Object
Experimental parser for Log4j 1.2 properties configuration files. This class is not thread-safe.

From the Log4j 1.2 Javadocs:

All option values admit variable substitution. The syntax of variable substitution is similar to that of Unix shells. The string between an opening "${" and closing "}" is interpreted as a key. The value of the substituted variable can be defined as a system property or in the configuration file itself. The value of the key is first searched in the system properties, and if not found there, it is then searched in the configuration file being parsed. The corresponding value replaces the ${variableName} sequence. For example, if java.home system property is set to /home/xyz, then every occurrence of the sequence ${java.home} will be interpreted as /home/xyz.

  • Field Details

  • Constructor Details

    • Log4j1ConfigurationParser

      public Log4j1ConfigurationParser()
  • Method Details

    • buildConfigurationBuilder

      public ConfigurationBuilder<BuiltConfiguration> buildConfigurationBuilder(InputStream input) throws IOException
      Parses a Log4j 1.2 properties configuration file in ISO 8859-1 encoding into a ConfigurationBuilder.
      Parameters:
      input - InputStream to read from is assumed to be ISO 8859-1, and will not be closed.
      Returns:
      the populated ConfigurationBuilder, never null
      Throws:
      IOException - if unable to read the input
      ConfigurationException - if the input does not contain a valid configuration
    • buildProperties

      private void buildProperties()
    • warn

      private void warn(String string)
    • buildClassToPropertyPrefixMap

      private Map<String,String> buildClassToPropertyPrefixMap()
    • buildAppender

      private void buildAppender(String appenderName, String appenderClass)
    • buildConsoleAppender

      private void buildConsoleAppender(String appenderName)
    • buildFileAppender

      private void buildFileAppender(String appenderName)
    • buildFileAppender

      private void buildFileAppender(String appenderName, AppenderComponentBuilder appenderBuilder)
    • buildDailyRollingFileAppender

      private void buildDailyRollingFileAppender(String appenderName)
    • buildRollingFileAppender

      private void buildRollingFileAppender(String appenderName)
    • buildAttribute

      private void buildAttribute(String componentName, ComponentBuilder<?> componentBuilder, String sourceAttributeName, String targetAttributeName)
    • buildMandatoryAttribute

      private void buildMandatoryAttribute(String componentName, ComponentBuilder<?> componentBuilder, String sourceAttributeName, String targetAttributeName)
    • buildNullAppender

      private void buildNullAppender(String appenderName)
    • buildAppenderLayout

      private void buildAppenderLayout(String name, AppenderComponentBuilder appenderBuilder)
    • newPatternLayout

      private LayoutComponentBuilder newPatternLayout(String pattern)
    • buildRootLogger

      private void buildRootLogger(String rootLoggerValue)
    • getLevelString

      private String getLevelString(String[] loggerParts, String defaultLevel)
    • buildLoggers

      private void buildLoggers(String prefix)
    • getLog4jAppenderValue

      private String getLog4jAppenderValue(String appenderName, String attributeName)
    • getProperty

      private String getProperty(String key)
    • getProperty

      private String getProperty(String key, String defaultValue)
    • getLog4jAppenderValue

      private String getLog4jAppenderValue(String appenderName, String attributeName, String defaultValue)
    • getLog4jValue

      private String getLog4jValue(String key)
    • reportWarning

      private void reportWarning(String msg)