Class ThrowableFormatOptions
- java.lang.Object
-
- org.apache.logging.log4j.core.impl.ThrowableFormatOptions
-
public final class ThrowableFormatOptions extends java.lang.ObjectContains options which control how aThrowablepattern is formatted.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLASS_NAMEprotected static ThrowableFormatOptionsDEFAULTDefault instance ofThrowableFormatOptions.private static intDEFAULT_LINESstatic java.lang.StringFILE_NAMEprivate static java.lang.StringFULLFormat the whole stack trace.private java.util.List<java.lang.String>ignorePackagesThe list of packages to filter.static java.lang.StringLINE_NUMBERprivate intlinesThe number of lines to write.static java.lang.StringLOCALIZED_MESSAGEstatic java.lang.StringMESSAGEstatic java.lang.StringMETHOD_NAMEprivate static java.lang.StringNONEDo not format the exception.private java.lang.StringseparatorThe stack trace separator.private static java.lang.StringSHORTFormat only the first line of the throwable.private java.lang.Stringsuffixprivate TextRenderertextRendererANSI renderer
-
Constructor Summary
Constructors Modifier Constructor Description protectedThrowableFormatOptions()Constructs the options for printing stack trace.protectedThrowableFormatOptions(int lines, java.lang.String separator, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Constructs the options for printing stack trace.protectedThrowableFormatOptions(java.util.List<java.lang.String> packages)Constructs the options for printing stack trace.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallLines()Determines if all lines should be printed.booleananyLines()Determines if any lines should be printed.java.util.List<java.lang.String>getIgnorePackages()Returns the list of packages to ignore (filter out).intgetLines()Returns the number of lines to write.java.lang.StringgetSeparator()Returns the stack trace separator.java.lang.StringgetSuffix()TextRenderergetTextRenderer()Returns the message rendered.booleanhasPackages()Determines if there are any packages to filter.intminLines(int maxLines)Returns the minimum between the lines and the max lines.static ThrowableFormatOptionsnewInstance(java.lang.String[] options)Creates a new instance based on the array of options.java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_LINES
private static final int DEFAULT_LINES
- See Also:
- Constant Field Values
-
DEFAULT
protected static final ThrowableFormatOptions DEFAULT
Default instance ofThrowableFormatOptions.
-
FULL
private static final java.lang.String FULL
Format the whole stack trace.- See Also:
- Constant Field Values
-
NONE
private static final java.lang.String NONE
Do not format the exception.- See Also:
- Constant Field Values
-
SHORT
private static final java.lang.String SHORT
Format only the first line of the throwable.- See Also:
- Constant Field Values
-
textRenderer
private final TextRenderer textRenderer
ANSI renderer
-
lines
private final int lines
The number of lines to write.
-
separator
private final java.lang.String separator
The stack trace separator.
-
suffix
private final java.lang.String suffix
-
ignorePackages
private final java.util.List<java.lang.String> ignorePackages
The list of packages to filter.
-
CLASS_NAME
public static final java.lang.String CLASS_NAME
- See Also:
- Constant Field Values
-
METHOD_NAME
public static final java.lang.String METHOD_NAME
- See Also:
- Constant Field Values
-
LINE_NUMBER
public static final java.lang.String LINE_NUMBER
- See Also:
- Constant Field Values
-
FILE_NAME
public static final java.lang.String FILE_NAME
- See Also:
- Constant Field Values
-
MESSAGE
public static final java.lang.String MESSAGE
- See Also:
- Constant Field Values
-
LOCALIZED_MESSAGE
public static final java.lang.String LOCALIZED_MESSAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ThrowableFormatOptions
protected ThrowableFormatOptions(int lines, java.lang.String separator, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Constructs the options for printing stack trace.- Parameters:
lines- The number of lines.separator- The stack trace separator.ignorePackages- The packages to filter.textRenderer- The ANSI renderersuffix-
-
ThrowableFormatOptions
protected ThrowableFormatOptions(java.util.List<java.lang.String> packages)
Constructs the options for printing stack trace.- Parameters:
packages- The packages to filter.
-
ThrowableFormatOptions
protected ThrowableFormatOptions()
Constructs the options for printing stack trace.
-
-
Method Detail
-
getLines
public int getLines()
Returns the number of lines to write.- Returns:
- The number of lines to write.
-
getSeparator
public java.lang.String getSeparator()
Returns the stack trace separator.- Returns:
- The stack trace separator.
-
getTextRenderer
public TextRenderer getTextRenderer()
Returns the message rendered.- Returns:
- the message rendered.
-
getIgnorePackages
public java.util.List<java.lang.String> getIgnorePackages()
Returns the list of packages to ignore (filter out).- Returns:
- The list of packages to ignore (filter out).
-
allLines
public boolean allLines()
Determines if all lines should be printed.- Returns:
- true for all lines, false otherwise.
-
anyLines
public boolean anyLines()
Determines if any lines should be printed.- Returns:
- true for any lines, false otherwise.
-
minLines
public int minLines(int maxLines)
Returns the minimum between the lines and the max lines.- Parameters:
maxLines- The maximum number of lines.- Returns:
- The number of lines to print.
-
hasPackages
public boolean hasPackages()
Determines if there are any packages to filter.- Returns:
- true if there are packages, false otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
newInstance
public static ThrowableFormatOptions newInstance(java.lang.String[] options)
Creates a new instance based on the array of options.- Parameters:
options- The array of options.- Returns:
- A new initialized instance.
-
getSuffix
public java.lang.String getSuffix()
-
-