public class ShortenedThrowableConverter extends ThrowableHandlingConverter
ThrowableHandlingConverter
(similar to logback's ThrowableProxyConverter
)
that formats stacktraces by doing the following:
maxDepthPerThrowable
.maxLength
.shortenedClassNameLength
.
See shortenedClassNameLength
.excludes
.evaluators
.rootCauseFirst
.PatternLayout
, you must configure conversionRule
as described here.
Options can be specified in the pattern in the following order:
For example,
<conversionRule conversionWord="stack"
converterClass="net.logstash.logback.stacktrace.ShortenedThrowableConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%thread] - %msg%n%stack{5,1024,10,rootFirst,regex1,regex2,evaluatorName}</pattern>
</encoder>
</appender>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CLASS_NAME_LENGTH |
static int |
DEFAULT_MAX_DEPTH_PER_THROWABLE |
static int |
DEFAULT_MAX_LENGTH |
static int |
FULL_CLASS_NAME_LENGTH |
static int |
FULL_MAX_DEPTH_PER_THROWABLE |
static int |
FULL_MAX_LENGTH |
static int |
SHORT_CLASS_NAME_LENGTH |
static int |
SHORT_MAX_DEPTH_PER_THROWABLE |
static int |
SHORT_MAX_LENGTH |
started
Constructor and Description |
---|
ShortenedThrowableConverter() |
Modifier and Type | Method and Description |
---|---|
void |
addEvaluator(EventEvaluator<ILoggingEvent> evaluator) |
void |
addExclude(String exclusionPattern) |
String |
convert(ILoggingEvent event) |
List<EventEvaluator<ILoggingEvent>> |
getEvaluators() |
List<String> |
getExcludes() |
int |
getMaxDepthPerThrowable() |
int |
getMaxLength() |
int |
getShortenedClassNameLength() |
boolean |
isInlineHash() |
boolean |
isRootCauseFirst() |
void |
setEvaluators(List<EventEvaluator<ILoggingEvent>> evaluators) |
void |
setExcludes(List<String> exclusionPatterns) |
void |
setExclusions(String comaSeparatedPatterns)
Set exclusion patterns as a list of coma separated patterns
|
void |
setInlineHash(boolean inlineHash) |
void |
setMaxDepthPerThrowable(int maxDepthPerThrowable) |
void |
setMaxLength(int maxLength) |
void |
setRootCauseFirst(boolean rootCauseFirst) |
void |
setShortenedClassNameLength(int length) |
protected void |
setStackHasher(StackHasher stackHasher) |
void |
start() |
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getFirstOption, getOptionList, isStarted, setContext, setOptionList, stop
getFormattingInfo, setFormattingInfo, write
public static final int FULL_MAX_DEPTH_PER_THROWABLE
public static final int SHORT_MAX_DEPTH_PER_THROWABLE
public static final int DEFAULT_MAX_DEPTH_PER_THROWABLE
public static final int FULL_MAX_LENGTH
public static final int SHORT_MAX_LENGTH
public static final int DEFAULT_MAX_LENGTH
public static final int FULL_CLASS_NAME_LENGTH
public static final int SHORT_CLASS_NAME_LENGTH
public static final int DEFAULT_CLASS_NAME_LENGTH
public void start()
start
in interface LifeCycle
start
in class DynamicConverter<ILoggingEvent>
public String convert(ILoggingEvent event)
convert
in class Converter<ILoggingEvent>
public int getShortenedClassNameLength()
public void setShortenedClassNameLength(int length)
public int getMaxDepthPerThrowable()
public void setMaxDepthPerThrowable(int maxDepthPerThrowable)
public void setMaxLength(int maxLength)
public int getMaxLength()
public boolean isRootCauseFirst()
public void setRootCauseFirst(boolean rootCauseFirst)
public boolean isInlineHash()
public void setInlineHash(boolean inlineHash)
protected void setStackHasher(StackHasher stackHasher)
public void addExclude(String exclusionPattern)
public void setExclusions(String comaSeparatedPatterns)
comaSeparatedPatterns
- list of coma separated patternspublic void addEvaluator(EventEvaluator<ILoggingEvent> evaluator)
public void setEvaluators(List<EventEvaluator<ILoggingEvent>> evaluators)
public List<EventEvaluator<ILoggingEvent>> getEvaluators()
Copyright © 2013–2021. All rights reserved.