Class StandardStackTracePrinter
java.lang.Object
org.springframework.boot.logging.StandardStackTracePrinter
- All Implemented Interfaces:
- StackTracePrinter
StackTracePrinter that prints a standard form stack trace. This printer
produces a result in a similar form to Throwable.printStackTrace(), but offers
more customization options.- Since:
- 3.5.0
- Author:
- Phillip Webb
- 
Method SummaryModifier and TypeMethodDescriptionvoidprintStackTrace(Throwable throwable, Appendable out) Prints a stack trace for the givenThrowable.static StandardStackTracePrinterReturn aStandardStackTracePrinterthat prints the stack trace with the root exception first (the opposite ofThrowable.printStackTrace()).static StandardStackTracePrinterrootLast()Return aStandardStackTracePrinterthat prints the stack trace with the root exception last (the same asThrowable.printStackTrace()).Return a newStandardStackTracePrinterfrom this one that will print all common frames rather the replacing them with the "... N more" message.withFilter(Predicate<Throwable> predicate) Return a newStandardStackTracePrinterfrom this one that will only include throwables (excluding caused and suppressed) that match the given predicate.withFormatter(Function<Throwable, String> formatter) Return a newStandardStackTracePrinterfrom this one uses the specified formatter to create a string representation of a throwable.withFrameFilter(BiPredicate<Integer, StackTraceElement> predicate) Return a newStandardStackTracePrinterfrom this one that will only include frames that match the given predicate.withFrameFormatter(Function<StackTraceElement, String> frameFormatter) Return a newStandardStackTracePrinterfrom this one uses the specified formatter to create a string representation of a frame.Return a newStandardStackTracePrinterfrom this one that generates and prints hashes for each stacktrace.withHashes(boolean hashes) Return a newStandardStackTracePrinterfrom this one that changes if hashes should be generated and printed for each stacktrace.withHashes(@Nullable ToIntFunction<StackTraceElement> frameHasher) withLineSeparator(String lineSeparator) Return a newStandardStackTracePrinterfrom this one that print the stack trace using the specified line separator.withMaximumLength(int maximumLength) Return a newStandardStackTracePrinterfrom this one that will use ellipses to truncate output longer that the specified length.withMaximumThrowableDepth(int maximumThrowableDepth) Return a newStandardStackTracePrinterfrom this one that filter frames (including caused and suppressed) deeper then the specified maximum.Return a newStandardStackTracePrinterfrom this one that will not printsuppresseditems.Methods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StackTracePrinterprintStackTraceToString
- 
Method Details- 
printStackTraceDescription copied from interface:StackTracePrinterPrints a stack trace for the givenThrowable.- Specified by:
- printStackTracein interface- StackTracePrinter
- Parameters:
- throwable- the throwable that should have its stack trace printed
- out- the destination to write output
- Throws:
- IOException- on IO error
 
- 
withCommonFramesReturn a newStandardStackTracePrinterfrom this one that will print all common frames rather the replacing them with the "... N more" message.- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withoutSuppressedReturn a newStandardStackTracePrinterfrom this one that will not printsuppresseditems.- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withMaximumLengthReturn a newStandardStackTracePrinterfrom this one that will use ellipses to truncate output longer that the specified length.- Parameters:
- maximumLength- the maximum length that can be printed
- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withMaximumThrowableDepthReturn a newStandardStackTracePrinterfrom this one that filter frames (including caused and suppressed) deeper then the specified maximum.- Parameters:
- maximumThrowableDepth- the maximum throwable depth
- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withFilterReturn a newStandardStackTracePrinterfrom this one that will only include throwables (excluding caused and suppressed) that match the given predicate.- Parameters:
- predicate- the predicate used to filter the throwable
- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withFrameFilterReturn a newStandardStackTracePrinterfrom this one that will only include frames that match the given predicate.- Parameters:
- predicate- the predicate used to filter frames
- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withLineSeparatorReturn a newStandardStackTracePrinterfrom this one that print the stack trace using the specified line separator.- Parameters:
- lineSeparator- the line separator to use
- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withFormatterReturn a newStandardStackTracePrinterfrom this one uses the specified formatter to create a string representation of a throwable.- Parameters:
- formatter- the formatter to use
- Returns:
- a new StandardStackTracePrinterinstance
- See Also:
 
- 
withFrameFormatterpublic StandardStackTracePrinter withFrameFormatter(Function<StackTraceElement, String> frameFormatter) Return a newStandardStackTracePrinterfrom this one uses the specified formatter to create a string representation of a frame.- Parameters:
- frameFormatter- the frame formatter to use
- Returns:
- a new StandardStackTracePrinterinstance
- See Also:
 
- 
withHashesReturn a newStandardStackTracePrinterfrom this one that generates and prints hashes for each stacktrace.- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withHashesReturn a newStandardStackTracePrinterfrom this one that changes if hashes should be generated and printed for each stacktrace.- Parameters:
- hashes- if hashes should be added
- Returns:
- a new StandardStackTracePrinterinstance
 
- 
withHashes
- 
rootLastReturn aStandardStackTracePrinterthat prints the stack trace with the root exception last (the same asThrowable.printStackTrace()).- Returns:
- a StandardStackTracePrinterthat prints the stack trace root last
 
- 
rootFirstReturn aStandardStackTracePrinterthat prints the stack trace with the root exception first (the opposite ofThrowable.printStackTrace()).- Returns:
- a StandardStackTracePrinterthat prints the stack trace root first
 
 
-