Module ch.qos.logback.classic
Class CallerContradictionAnalyser
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.model.processor.ModelHandlerBase
-
- ch.qos.logback.classic.model.processor.CallerContradictionAnalyser
-
- All Implemented Interfaces:
ContextAware
public class CallerContradictionAnalyser extends ModelHandlerBase
Dependency-analysis pass over everyAppenderModel: records which appenders suppress caller data (AsyncAppender,SocketAppenderorSMTPAppenderwithincludeCallerData=false/ default) and which appenders need it (pattern contains a caller-data converter).SMTPAppenderis special: it both preprocesses caller data (includeCallerData) and formats events via its own layout. Those two contributions are recorded as separate map entries undername +INCLUDE_CALLER_DATA_NAME_SUFFIXandname +LAYOUT_NAME_SUFFIXso that contradictions within a single SMTP appender (e.g. includeCallerData=false but layout uses%C) can be detected.Analysis is skipped when the variable "logback.skipCallerContradictionAnalysis" is set to
true(context property, local property, system property or environment variable).The contradiction check is performed by
CallerContradictionWarnAnalyserin itspostHandle()on the enclosingConfigurationModel, after all appender models have been visited.- Since:
- 1.6.2
- See Also:
CallerContradictionWarnAnalyser
-
-
Field Summary
Fields Modifier and Type Field Description static StringSKIP_CALLER_CONTRADICTION_ANALYSIS_PROPERTYWhen this property/variable istrue, caller-contradiction analysis is not performed.-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description CallerContradictionAnalyser(Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Class<AppenderModel>getSupportedModelClass()Subclasses should return the subclass of Model that they expect to handle.voidhandle(ModelInterpretationContext mic, Model model)-
Methods inherited from class ch.qos.logback.core.model.processor.ModelHandlerBase
isSupportedModelType, postHandle, toString
-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
-
-
-
Field Detail
-
SKIP_CALLER_CONTRADICTION_ANALYSIS_PROPERTY
public static final String SKIP_CALLER_CONTRADICTION_ANALYSIS_PROPERTY
When this property/variable istrue, caller-contradiction analysis is not performed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CallerContradictionAnalyser
public CallerContradictionAnalyser(Context context)
-
-
Method Detail
-
getSupportedModelClass
protected Class<AppenderModel> getSupportedModelClass()
Description copied from class:ModelHandlerBaseSubclasses should return the subclass of Model that they expect to handle. The default implementation assumes that all Model classes are supported. This a very lax assumption which is usually not true.- Overrides:
getSupportedModelClassin classModelHandlerBase- Returns:
- supported model class
- See Also:
ModelHandlerBase.isSupportedModelType(Model)
-
handle
public void handle(ModelInterpretationContext mic, Model model) throws ModelHandlerException
- Specified by:
handlein classModelHandlerBase- Throws:
ModelHandlerException
-
-