Class ExceptionFormatter
- java.lang.Object
-
- org.logevents.formatters.exceptions.AbstractExceptionFormatter
-
- org.logevents.formatters.exceptions.ExceptionFormatter
-
- Direct Known Subclasses:
CauseFirstExceptionFormatter
,MicrosoftTeamsExceptionFormatter
public class ExceptionFormatter extends AbstractExceptionFormatter
Presents the exception of a Log Event as a nicely formatted textual representation. Supports filtering stack traces by package and (forSlackExceptionFormatter
) including a link to the corresponding source code.Example configuration
observer.x.formatter.exceptionFormatter=
You can also specify package filters for all observers:CauseFirstExceptionFormatter
observer.x.formatter.exceptionFormatter.packageFilter=sun.www, com.example.uninteresting observer.x.formatter.sourceCode.1.package=org.logevents observer.x.formatter.sourceCode.1.github=jhannes/logeventsobserver.*.packageFilter=sun.www, com.example.uninteresting
- Author:
- Johannes Brodwall
-
-
Field Summary
-
Fields inherited from class org.logevents.formatters.exceptions.AbstractExceptionFormatter
includePackagingData, maxLength, packageFilter, sourceCodeLookup
-
-
Constructor Summary
Constructors Constructor Description ExceptionFormatter()
ExceptionFormatter(Map<String,String> properties, String prefix)
ExceptionFormatter(Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(Throwable ex)
protected void
formatFrame(StringBuilder builder, StackTraceElement frame)
protected String
increaseIndent(String indent)
protected void
outputException(Throwable ex, Throwable enclosing, String prefix, String indent, StringBuilder builder)
protected void
outputExceptionHeader(Throwable ex, String prefix, String indent, StringBuilder builder)
protected void
outputIgnoredCommonLines(int commonLines, String indent, StringBuilder builder)
protected StringBuilder
outputIgnoredFrameCount(int ignored, StringBuilder builder)
protected void
outputStack(Throwable ex, String indent, Throwable enclosing, StringBuilder builder)
void
outputStackFrame(StackTraceElement frame, int ignored, String indent, StringBuilder builder)
-
Methods inherited from class org.logevents.formatters.exceptions.AbstractExceptionFormatter
configureSourceCode, findCommonStart, getCodeSource, getPackagingData, getPackagingData, getVersion, isIgnored, newLine, setMaxLength, setPackageFilter, setSourceCodeLookup, uniquePrefix
-
-
-
-
Constructor Detail
-
ExceptionFormatter
public ExceptionFormatter()
-
ExceptionFormatter
public ExceptionFormatter(Configuration configuration)
-
-
Method Detail
-
outputException
protected void outputException(Throwable ex, Throwable enclosing, String prefix, String indent, StringBuilder builder)
-
outputExceptionHeader
protected void outputExceptionHeader(Throwable ex, String prefix, String indent, StringBuilder builder)
-
outputStack
protected void outputStack(Throwable ex, String indent, Throwable enclosing, StringBuilder builder)
-
outputStackFrame
public void outputStackFrame(StackTraceElement frame, int ignored, String indent, StringBuilder builder)
-
formatFrame
protected void formatFrame(StringBuilder builder, StackTraceElement frame)
-
outputIgnoredCommonLines
protected void outputIgnoredCommonLines(int commonLines, String indent, StringBuilder builder)
-
outputIgnoredFrameCount
protected StringBuilder outputIgnoredFrameCount(int ignored, StringBuilder builder)
-
-