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.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private Charset
private Configuration
private boolean
private String
private String
private boolean
private String
private PatternSelector
private RegexReplacement
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the object after all configuration has been set.private boolean
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)
-
Field Details
-
pattern
-
patternSelector
-
configuration
-
regexReplacement
-
charset
-
alwaysWriteExceptions
-
disableAnsi
-
noConsoleNoAnsi
-
header
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
useAnsiEscapeCodes
private boolean useAnsiEscapeCodes() -
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 footer 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.
-