public final class PatternParser extends Object
PatternLayout
class is delegated to the
PatternParser class.
It is this class that parses conversion patterns and creates a chained list of PatternConverters
.
Constructor and Description |
---|
PatternParser(Configuration config,
String converterKey,
Class<?> expected)
Constructor.
|
PatternParser(Configuration config,
String converterKey,
Class<?> expectedClass,
Class<?> filterClass)
Constructor.
|
PatternParser(String converterKey)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
List<PatternFormatter> |
parse(String pattern) |
List<PatternFormatter> |
parse(String pattern,
boolean alwaysWriteExceptions,
boolean noConsoleNoAnsi) |
List<PatternFormatter> |
parse(String pattern,
boolean alwaysWriteExceptions,
boolean disableAnsi,
boolean noConsoleNoAnsi) |
void |
parse(String pattern,
List<PatternConverter> patternConverters,
List<FormattingInfo> formattingInfos,
boolean noConsoleNoAnsi,
boolean convertBackslashes)
Parse a format specifier.
|
void |
parse(String pattern,
List<PatternConverter> patternConverters,
List<FormattingInfo> formattingInfos,
boolean disableAnsi,
boolean noConsoleNoAnsi,
boolean convertBackslashes)
Parse a format specifier.
|
public PatternParser(String converterKey)
converterKey
- The type of converters that will be used.public PatternParser(Configuration config, String converterKey, Class<?> expected)
config
- The current Configuration or null
.converterKey
- The key to lookup the converters.expected
- The expected base Class of each Converter or null
.public PatternParser(Configuration config, String converterKey, Class<?> expectedClass, Class<?> filterClass)
config
- The current Configuration or null
.converterKey
- The key to lookup the converters.expectedClass
- The expected base Class of each Converter or null
.filterClass
- Filter the returned plugins after calling the plugin manager, can be null
.public List<PatternFormatter> parse(String pattern)
public List<PatternFormatter> parse(String pattern, boolean alwaysWriteExceptions, boolean noConsoleNoAnsi)
public List<PatternFormatter> parse(String pattern, boolean alwaysWriteExceptions, boolean disableAnsi, boolean noConsoleNoAnsi)
public void parse(String pattern, List<PatternConverter> patternConverters, List<FormattingInfo> formattingInfos, boolean noConsoleNoAnsi, boolean convertBackslashes)
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 if System.console()
convertBackslashes
- if true
, backslash characters are treated as escape characters and character
sequences like "\" followed by "t" (backslash+t) are converted to special characters like '\t' (tab).public void parse(String pattern, List<PatternConverter> patternConverters, List<FormattingInfo> formattingInfos, boolean disableAnsi, boolean noConsoleNoAnsi, boolean convertBackslashes)
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 if System.console()
convertBackslashes
- if true
, backslash characters are treated as escape characters and character
sequences like "\" followed by "t" (backslash+t) are converted to special characters like '\t' (tab). Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.