Class 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.

    • Constructor Detail

      • Log4j1ConfigurationParser

        public Log4j1ConfigurationParser()
    • Method Detail

      • 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