java.lang.Object
ch.qos.logback.classic.pattern.EnsureExceptionHandling
- All Implemented Interfaces:
PostCompileProcessor<ILoggingEvent>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
This method computes whether a chain of converters handles exceptions or not.boolean
compositeHandlesThrowable
(CompositeConverter<ILoggingEvent> compositeConverter) This method computes whether a composite converter handles exceptions or not.void
process
(Context context, Converter<ILoggingEvent> head) This implementation checks if any of the converters in the chain handles exceptions.
-
Constructor Details
-
EnsureExceptionHandling
public EnsureExceptionHandling()
-
-
Method Details
-
process
This implementation checks if any of the converters in the chain handles exceptions. If not, then this method adds aExtendedThrowableProxyConverter
instance to the end of the chain.This allows appenders using this layout to output exception information event if the user forgets to add %ex to the pattern. Note that the appenders defined in the Core package are not aware of exceptions nor LoggingEvents.
If for some reason the user wishes to NOT print exceptions, then she can add %nopex to the pattern.
- Specified by:
process
in interfacePostCompileProcessor<ILoggingEvent>
- Parameters:
head
- The first converter in the chain
-
chainHandlesThrowable
This method computes whether a chain of converters handles exceptions or not.- Parameters:
head
- The first element of the chain- Returns:
- true if it can handle throwables contained in logging events
-
compositeHandlesThrowable
This method computes whether a composite converter handles exceptions or not.- Parameters:
compositeConverter
- The composite converter- Returns:
- true if it can handle throwables contained in logging events
-