Class PatternLayout.Builder
java.lang.Object
org.apache.logging.log4j.core.layout.PatternLayout.Builder
- All Implemented Interfaces:
Builder<PatternLayout>
- Enclosing class:
- PatternLayout
Custom PatternLayout builder. Use the
builder factory method
to create this.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the object after all configuration has been set.withAlwaysWriteExceptions
(boolean alwaysWriteExceptions) withCharset
(Charset charset) withConfiguration
(Configuration configuration) withDisableAnsi
(boolean disableAnsi) withFooter
(String footer) withHeader
(String header) withNoConsoleNoAnsi
(boolean noConsoleNoAnsi) withPattern
(String pattern) withPatternSelector
(PatternSelector patternSelector) withRegexReplacement
(RegexReplacement regexReplacement) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
Method Details
-
withPattern
- Parameters:
pattern
- The pattern. If not specified, defaults to DEFAULT_CONVERSION_PATTERN.
-
withPatternSelector
- Parameters:
patternSelector
- Allows different patterns to be used based on some selection criteria.
-
withConfiguration
- Parameters:
configuration
- The Configuration. Some Converters require access to the Interpolator.
-
withRegexReplacement
- Parameters:
regexReplacement
- A Regex replacement
-
withCharset
- Parameters:
charset
- The character set. The platform default is used if not specified.
-
withAlwaysWriteExceptions
- Parameters:
alwaysWriteExceptions
- If"true"
(default) exceptions are always written even if the pattern contains no exception tokens.
-
withDisableAnsi
- Parameters:
disableAnsi
- If"true"
(default is value of system property `log4j.skipJansi`, or `true` if undefined), do not output ANSI escape codes
-
withNoConsoleNoAnsi
- Parameters:
noConsoleNoAnsi
- If"true"
(default is false) andSystem.console()
is null, do not output ANSI escape codes
-
withHeader
- Parameters:
header
- The header to place at the top of the document, once.
-
build
Description copied from interface:Builder
Builds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
build
in interfaceBuilder<PatternLayout>
- Returns:
- the configured instance.
-