public static class PatternLayout.Builder extends Object implements Builder<PatternLayout>
builder factory method
to create this.Modifier and Type | Method and Description |
---|---|
PatternLayout |
build()
Builds the object after all configuration has been set.
|
PatternLayout.Builder |
withAlwaysWriteExceptions(boolean alwaysWriteExceptions) |
PatternLayout.Builder |
withCharset(Charset charset) |
PatternLayout.Builder |
withConfiguration(Configuration configuration) |
PatternLayout.Builder |
withDisableAnsi(boolean disableAnsi) |
PatternLayout.Builder |
withFooter(String footer) |
PatternLayout.Builder |
withHeader(String header) |
PatternLayout.Builder |
withNoConsoleNoAnsi(boolean noConsoleNoAnsi) |
PatternLayout.Builder |
withPattern(String pattern) |
PatternLayout.Builder |
withPatternSelector(PatternSelector patternSelector) |
PatternLayout.Builder |
withRegexReplacement(RegexReplacement regexReplacement) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getErrorPrefix, isValid
public PatternLayout.Builder withPattern(String pattern)
pattern
- The pattern. If not specified, defaults to DEFAULT_CONVERSION_PATTERN.public PatternLayout.Builder withPatternSelector(PatternSelector patternSelector)
patternSelector
- Allows different patterns to be used based on some selection criteria.public PatternLayout.Builder withConfiguration(Configuration configuration)
configuration
- The Configuration. Some Converters require access to the Interpolator.public PatternLayout.Builder withRegexReplacement(RegexReplacement regexReplacement)
regexReplacement
- A Regex replacementpublic PatternLayout.Builder withCharset(Charset charset)
charset
- The character set. The platform default is used if not specified.public PatternLayout.Builder withAlwaysWriteExceptions(boolean alwaysWriteExceptions)
alwaysWriteExceptions
- If "true"
(default) exceptions are always written even if the pattern contains no exception tokens.public PatternLayout.Builder withDisableAnsi(boolean disableAnsi)
disableAnsi
- If "true"
(default is value of system property `log4j.skipJansi`, or `true` if undefined),
do not output ANSI escape codespublic PatternLayout.Builder withNoConsoleNoAnsi(boolean noConsoleNoAnsi)
noConsoleNoAnsi
- If "true"
(default is false) and System.console()
is null, do not output ANSI escape codespublic PatternLayout.Builder withHeader(String header)
header
- The footer to place at the top of the document, once.public PatternLayout.Builder withFooter(String footer)
footer
- The footer to place at the bottom of the document, once.public PatternLayout build()
Builder
build
in interface Builder<PatternLayout>
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.