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.setAlwaysWriteExceptions(boolean alwaysWriteExceptions) setCharset(Charset charset) setConfiguration(Configuration configuration) setDisableAnsi(boolean disableAnsi) setNoConsoleNoAnsi(boolean noConsoleNoAnsi) setPattern(String pattern) setPatternSelector(PatternSelector patternSelector) setRegexReplacement(RegexReplacement regexReplacement) withAlwaysWriteExceptions(boolean alwaysWriteExceptions) Deprecated.withCharset(Charset charset) Deprecated.since 2.26.0 usesetCharset(Charset).withConfiguration(Configuration configuration) Deprecated.since 2.26.0 usesetConfiguration(Configuration).withDisableAnsi(boolean disableAnsi) Deprecated.since 2.26.0 usesetDisableAnsi(boolean).withFooter(String footer) Deprecated.since 2.26.0 usesetFooter(String).withHeader(String header) Deprecated.since 2.26.0 usesetHeader(String).withNoConsoleNoAnsi(boolean noConsoleNoAnsi) Deprecated.since 2.26.0 usesetNoConsoleNoAnsi(boolean).withPattern(String pattern) Deprecated.since 2.26.0 usesetPattern(String).withPatternSelector(PatternSelector patternSelector) Deprecated.since 2.26.0 usesetPatternSelector(PatternSelector).withRegexReplacement(RegexReplacement regexReplacement) Deprecated.since 2.26.0 usesetRegexReplacement(RegexReplacement).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
Method Details
-
setPattern
- Parameters:
pattern- The pattern. If not specified, defaults to DEFAULT_CONVERSION_PATTERN.- Since:
- 2.26.0
-
setPatternSelector
- Parameters:
patternSelector- Allows different patterns to be used based on some selection criteria.- Since:
- 2.26.0
-
setConfiguration
- Parameters:
configuration- The Configuration. Some Converters require access to the Interpolator.- Since:
- 2.26.0
-
setRegexReplacement
- Parameters:
regexReplacement- A Regex replacement- Since:
- 2.26.0
-
setCharset
- Parameters:
charset- The character set. The platform default is used if not specified.- Since:
- 2.26.0
-
setAlwaysWriteExceptions
- Parameters:
alwaysWriteExceptions- If"true"(default) exceptions are always written even if the pattern contains no exception tokens.- Since:
- 2.26.0
-
setDisableAnsi
- Parameters:
disableAnsi- Iftrue, do not output ANSI escape codes.- Since:
- 2.26.0
-
setNoConsoleNoAnsi
- Parameters:
noConsoleNoAnsi- If"true"(default is false) andSystem.console()is null, do not output ANSI escape codes- Since:
- 2.26.0
-
setHeader
- Parameters:
header- The header to place at the top of the document, once.- Since:
- 2.26.0
-
withPattern
Deprecated.since 2.26.0 usesetPattern(String). -
withPatternSelector
Deprecated.since 2.26.0 usesetPatternSelector(PatternSelector). -
withConfiguration
Deprecated.since 2.26.0 usesetConfiguration(Configuration). -
withRegexReplacement
Deprecated.since 2.26.0 usesetRegexReplacement(RegexReplacement). -
withCharset
Deprecated.since 2.26.0 usesetCharset(Charset). -
withAlwaysWriteExceptions
Deprecated.since 2.26.0 usesetAlwaysWriteExceptions(boolean). -
withDisableAnsi
Deprecated.since 2.26.0 usesetDisableAnsi(boolean). -
withNoConsoleNoAnsi
Deprecated.since 2.26.0 usesetNoConsoleNoAnsi(boolean). -
withHeader
Deprecated.since 2.26.0 usesetHeader(String). -
build
Description copied from interface:BuilderBuilds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
buildin interfaceBuilder<PatternLayout>- Returns:
- the configured instance.
-
setAlwaysWriteExceptions(boolean).