Class PatternParser
- java.lang.Object
-
- org.apache.logging.log4j.core.pattern.PatternParser
-
public final class PatternParser extends java.lang.Object
Most of the work of thePatternLayout
class is delegated to the PatternParser class.It is this class that parses conversion patterns and creates a chained list of
PatternConverters
.
-
-
Constructor Summary
Constructors Constructor Description PatternParser(java.lang.String converterKey)
Constructor.PatternParser(Configuration config, java.lang.String converterKey, java.lang.Class<?> expected)
Constructor.PatternParser(Configuration config, java.lang.String converterKey, java.lang.Class<?> expectedClass, java.lang.Class<?> filterClass)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<PatternFormatter>
parse(java.lang.String pattern)
java.util.List<PatternFormatter>
parse(java.lang.String pattern, boolean alwaysWriteExceptions, boolean noConsoleNoAnsi)
java.util.List<PatternFormatter>
parse(java.lang.String pattern, boolean alwaysWriteExceptions, boolean disableAnsi, boolean noConsoleNoAnsi)
void
parse(java.lang.String pattern, java.util.List<PatternConverter> patternConverters, java.util.List<FormattingInfo> formattingInfos, boolean noConsoleNoAnsi, boolean convertBackslashes)
Parse a format specifier.void
parse(java.lang.String pattern, java.util.List<PatternConverter> patternConverters, java.util.List<FormattingInfo> formattingInfos, boolean disableAnsi, boolean noConsoleNoAnsi, boolean convertBackslashes)
Parse a format specifier.
-
-
-
Constructor Detail
-
PatternParser
public PatternParser(java.lang.String converterKey)
Constructor.- Parameters:
converterKey
- The type of converters that will be used.
-
PatternParser
public PatternParser(Configuration config, java.lang.String converterKey, java.lang.Class<?> expected)
Constructor.- Parameters:
config
- The current Configuration.converterKey
- The key to lookup the converters.expected
- The expected base Class of each Converter.
-
PatternParser
public PatternParser(Configuration config, java.lang.String converterKey, java.lang.Class<?> expectedClass, java.lang.Class<?> filterClass)
Constructor.- Parameters:
config
- The current Configuration.converterKey
- The key to lookup the converters.expectedClass
- The expected base Class of each Converter.filterClass
- Filter the returned plugins after calling the plugin manager.
-
-
Method Detail
-
parse
public java.util.List<PatternFormatter> parse(java.lang.String pattern)
-
parse
public java.util.List<PatternFormatter> parse(java.lang.String pattern, boolean alwaysWriteExceptions, boolean noConsoleNoAnsi)
-
parse
public java.util.List<PatternFormatter> parse(java.lang.String pattern, boolean alwaysWriteExceptions, boolean disableAnsi, boolean noConsoleNoAnsi)
-
parse
public void parse(java.lang.String pattern, java.util.List<PatternConverter> patternConverters, java.util.List<FormattingInfo> formattingInfos, boolean noConsoleNoAnsi, boolean convertBackslashes)
Parse a format specifier.- Parameters:
pattern
- pattern to parse.patternConverters
- list to receive pattern converters.formattingInfos
- list to receive field specifiers corresponding to pattern converters.noConsoleNoAnsi
- do not do not output ANSI escape codes ifSystem.console()
convertBackslashes
- iftrue
, backslash characters are treated as escape characters and character sequences like "\" followed by "t" (backslash+t) are converted to special characters like '\t' (tab).
-
parse
public void parse(java.lang.String pattern, java.util.List<PatternConverter> patternConverters, java.util.List<FormattingInfo> formattingInfos, boolean disableAnsi, boolean noConsoleNoAnsi, boolean convertBackslashes)
Parse a format specifier.- Parameters:
pattern
- pattern to parse.patternConverters
- list to receive pattern converters.formattingInfos
- list to receive field specifiers corresponding to pattern converters.disableAnsi
- do not output ANSI escape codesnoConsoleNoAnsi
- do not do not output ANSI escape codes ifSystem.console()
convertBackslashes
- iftrue
, backslash characters are treated as escape characters and character sequences like "\" followed by "t" (backslash+t) are converted to special characters like '\t' (tab).
-
-