Package ch.qos.logback.core.spi

## Class ContextAwareBase

- java.lang.Object
- - ch.qos.logback.core.spi.ContextAwareBase

All Implemented Interfaces:
  `ContextAware`

Direct Known Subclasses:
  `AbstractDiscriminator`, `Action`, `AppenderBase`, `BasicConfigurator`, `BeanDescriptionCache`, `BeanDescriptionFactory`, `ComponentDelegate`, `Compressor`, `ConcurrentServerRunner`, `ConfigurationDelegate`, `ConfigurationWatchList`, `ConnectionSourceBase`, `ContextUtil`, `DBUtil`, `EncoderBase`, `EventEvaluatorBase`, `FileNamePattern`, `FileUtil`, `Filter`, `GenericConfigurator`, `InterpretationContext`, `InterruptUtil`, `JMXConfigurator`, `LayoutBase`, `LevelChangePropagator`, `LoggerContextAwareBase`, `Matcher`, `OnPrintStreamStatusListenerBase`, `Parser`, `PropertyDefinerBase`, `PropertyEvalScriptBuilder`, `PropertySetter`, `ReceiverBase`, `ReconfigureOnChangeTask`, `RenameUtil`, `RollingPolicyBase`, `ShutdownHookBase`, `SimpleRuleStore`, `SSLParametersConfiguration`, `StaxEventRecorder`, `TimeBasedArchiveRemover`, `TimeBasedFileNamingAndTriggeringPolicyBase`, `TriggeringPolicyBase`, `TurboFilter`, `UnsynchronizedAppenderBase`, `URLEvaluator`

    public class ContextAwareBase
    extends java.lang.Object
    implements ContextAware

A helper class that implements ContextAware methods. A class can implement the ContextAware interface by deriving from this class.

Author:
  Ceki Gülcü

### Field Summary

Fields
`protected Context` `context`

### Constructor Summary

Constructors
`ContextAwareBase()`
`ContextAwareBase​(ContextAware declaredOrigin)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addError​(java.lang.String msg)`
`void` `addError​(java.lang.String msg, java.lang.Throwable ex)`
`void` `addInfo​(java.lang.String msg)`
`void` `addInfo​(java.lang.String msg, java.lang.Throwable ex)`
`void` `addStatus​(Status status)`
`void` `addWarn​(java.lang.String msg)`
`void` `addWarn​(java.lang.String msg, java.lang.Throwable ex)`
`Context` `getContext()`
`protected java.lang.Object` `getDeclaredOrigin()` The declared origin of status messages.
`StatusManager` `getStatusManager()`
`void` `setContext​(Context context)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### context

    protected Context context

### Constructor Detail

#### ContextAwareBase

    public ContextAwareBase()

#### ContextAwareBase

    public ContextAwareBase​(ContextAware declaredOrigin)

### Method Detail

#### setContext

    public void setContext​(Context context)

Specified by:
  `setContext` in interface `ContextAware`

#### getContext

    public Context getContext()

Specified by:
  `getContext` in interface `ContextAware`

#### getStatusManager

    public StatusManager getStatusManager()

#### getDeclaredOrigin

    protected java.lang.Object getDeclaredOrigin()

The declared origin of status messages. By default 'this'. Derived classes may override this method to declare other origin.

Returns:
  the declared origin, by default 'this'

#### addStatus

    public void addStatus​(Status status)

Specified by:
  `addStatus` in interface `ContextAware`

#### addInfo

    public void addInfo​(java.lang.String msg)

Specified by:
  `addInfo` in interface `ContextAware`

#### addInfo

    public void addInfo​(java.lang.String msg,
                        java.lang.Throwable ex)

Specified by:
  `addInfo` in interface `ContextAware`

#### addWarn

    public void addWarn​(java.lang.String msg)

Specified by:
  `addWarn` in interface `ContextAware`

#### addWarn

    public void addWarn​(java.lang.String msg,
                        java.lang.Throwable ex)

Specified by:
  `addWarn` in interface `ContextAware`

#### addError

    public void addError​(java.lang.String msg)

Specified by:
  `addError` in interface `ContextAware`

#### addError

    public void addError​(java.lang.String msg,
                         java.lang.Throwable ex)

Specified by:
  `addError` in interface `ContextAware`