Package org.apache.log4j.config
Class Log4j1ConfigurationParser
java.lang.Object
org.apache.log4j.config.Log4j1ConfigurationParser
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final ConfigurationBuilder<BuiltConfiguration> private static final Stringprivate static final Stringprivate static final Stringprivate final Propertiesprivate static final Stringprivate static final Stringprivate static final Stringprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbuildAppender(String appenderName, String appenderClass) private voidbuildAppenderLayout(String name, AppenderComponentBuilder appenderBuilder) private voidbuildAttribute(String componentName, ComponentBuilder<?> componentBuilder, String sourceAttributeName, String targetAttributeName) Parses a Log4j 1.2 properties configuration file in ISO 8859-1 encoding into a ConfigurationBuilder.private voidbuildConsoleAppender(String appenderName) private voidbuildDailyRollingFileAppender(String appenderName) private voidbuildFileAppender(String appenderName) private voidbuildFileAppender(String appenderName, AppenderComponentBuilder appenderBuilder) private voidbuildLoggers(String prefix) private voidbuildMandatoryAttribute(String componentName, ComponentBuilder<?> componentBuilder, String sourceAttributeName, String targetAttributeName) private voidbuildNullAppender(String appenderName) private voidprivate voidbuildRollingFileAppender(String appenderName) private voidbuildRootLogger(String rootLoggerValue) private StringgetLevelString(String[] loggerParts, String defaultLevel) private StringgetLog4jAppenderValue(String appenderName, String attributeName) private StringgetLog4jAppenderValue(String appenderName, String attributeName, String defaultValue) private StringgetLog4jValue(String key) private StringgetProperty(String key) private StringgetProperty(String key, String defaultValue) private LayoutComponentBuildernewPatternLayout(String pattern) private voidreportWarning(String msg) private void
-
Field Details
-
COMMA_DELIMITED_RE
- See Also:
-
ROOTLOGGER
- See Also:
-
ROOTCATEGORY
- See Also:
-
TRUE
- See Also:
-
FALSE
- See Also:
-
RELATIVE
- See Also:
-
NULL
- See Also:
-
properties
-
builder
-
-
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 inputConfigurationException- if the input does not contain a valid configuration
-
buildProperties
private void buildProperties() -
warn
-
buildClassToPropertyPrefixMap
-
buildAppender
-
buildConsoleAppender
-
buildFileAppender
-
buildFileAppender
-
buildDailyRollingFileAppender
-
buildRollingFileAppender
-
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
-
buildAppenderLayout
-
newPatternLayout
-
buildRootLogger
-
getLevelString
-
buildLoggers
-
getLog4jAppenderValue
-
getProperty
-
getProperty
-
getLog4jAppenderValue
-
getLog4jValue
-
reportWarning
-