Class LogFormatter.ThrowableFormatter.Builder
java.lang.Object
io.jstach.rainbowgum.LogFormatter.ThrowableFormatter.Builder
- Enclosing interface:
LogFormatter.ThrowableFormatter
Builds a configurable
LogFormatter.ThrowableFormatter.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the formatter.Regular expressions matched withMatcher.find()against each frame'sStackTraceElement.toString().maxLines(int maxLines) Maximum number of stack frame ("at ...") lines printed per throwable in the chain.packagingData(boolean packagingData) Whether to append packaging data (the jar or module a frame's class was loaded from, and its version) after each frame line, e.g.
-
Method Details
-
maxLines
Maximum number of stack frame ("at ...") lines printed per throwable in the chain. UseInteger.MAX_VALUEfor no limit (the default, and matchesLogFormatter.ThrowableFormatter.of()for well behaved throwables).0prints just the throwable header lines (class and message) for the whole chain with no frames at all.- Parameters:
maxLines- maximum stack frame lines per throwable.- Returns:
- this builder.
-
excludes
Regular expressions matched withMatcher.find()against each frame'sStackTraceElement.toString(). A frame matching any of these is omitted entirely and does not count againstmaxLines(int). Defaults to empty (no filtering).- Parameters:
excludes- exclude patterns.- Returns:
- this builder.
-
packagingData
Whether to append packaging data (the jar or module a frame's class was loaded from, and its version) after each frame line, e.g.[myapp-1.0.jar:1.0]or[java.base:na]. This mirrors (but does not byte-for-byte match) logback'sExtendedThrowableProxyConverteroutput. Resolution requires loading the frame's class (without initializing it) and can fail silently to[na:na]for frames whose class cannot be loaded (e.g. dynamically generated classes). This has a real per-frame cost so it defaults tofalse.- Parameters:
packagingData- true to append packaging data.- Returns:
- this builder.
-
build
Builds the formatter. If none ofmaxLines(int),excludes(List), orpackagingData(boolean)were set away from their defaults, returnsLogFormatter.ThrowableFormatter.of()(i.e. plainThrowable.printStackTrace()behavior) instead of constructing a formatter that walks the throwable manually for no reason.- Returns:
- formatter.
-