# Class LoggerAppender

Abstract class that defines output logs strategies.

  LoggerConfigurable
  LoggerAppender

#### Direct known subclasses

LoggerAppenderConsole, LoggerAppenderEcho, LoggerAppenderSocket, LoggerAppenderSyslog, LoggerAppenderFile, LoggerAppenderFirePHP, LoggerAppenderMail, LoggerAppenderMailEvent, LoggerAppenderMongoDB, LoggerAppenderNull, LoggerAppenderPDO, LoggerAppenderPhp

#### Indirect known subclasses

LoggerAppenderDailyFile, LoggerAppenderRollingFile
Abstract
Package: log4php
Version: $Revision: 1374777 $
Located at LoggerAppender.php

Methods summary
`public` | # `__construct( string $name = '' )` Default constructor. Default constructor.

#### Parameters

$name
  `string`
  $name Appender name

`public` | # `__destruct( )`
`public `LoggerLayout`` | # `getDefaultLayout( )` Returns the default layout for this appender. Can be overriden by derived appenders. Returns the default layout for this appender. Can be overriden by derived appenders.

#### Returns

``LoggerLayout``
`public` | # `addFilter( `LoggerFilter` $filter )` Adds a filter to the end of the filter chain. Adds a filter to the end of the filter chain.

#### Parameters

$filter
  ``LoggerFilter``
  $filter add a new LoggerFilter

`public` | # `clearFilters( )` Clears the filter chain by removing all the filters in it. Clears the filter chain by removing all the filters in it.
`public `LoggerFilter`` | # `getFilter( )` Returns the first filter in the filter chain. The return value may be null if no is filter is set. Returns the first filter in the filter chain. The return value may be null if no is filter is set.

#### Returns

``LoggerFilter``
`public `LoggerFilter`` | # `getFirstFilter( )` Returns the first filter in the filter chain. The return value may be null if no is filter is set. Returns the first filter in the filter chain. The return value may be null if no is filter is set.

#### Returns

``LoggerFilter``
`public` | # `doAppend( `LoggerLoggingEvent` $event )` Performs threshold checks and invokes filters before delegating logging to the subclass' specific append() method. Performs threshold checks and invokes filters before delegating logging to the subclass' specific append() method.

#### Parameters

$event
  ``LoggerLoggingEvent``
  $event

#### See

``LoggerAppender::append()``
`public` | # `setLayout( `LoggerLayout` $layout )` Sets the appender layout. Sets the appender layout.

#### Parameters

$layout
  ``LoggerLayout``
  $layout

`public `LoggerLayout`` | # `getLayout( )` Returns the appender layout. Returns the appender layout.

#### Returns

``LoggerLayout``
`public boolean` | # `requiresLayout( )` Configurators call this method to determine if the appender requires a layout. Configurators call this method to determine if the appender requires a layout. If this method returns true, meaning that layout is required, then the configurator will configure a layout using the configuration information at its disposal. If this method returns false, meaning that a layout is not required, then layout configuration will be skipped even if there is available layout configuration information at the disposal of the configurator.

In the rather exceptional case, where the appender implementation admits a layout but can also work without it, then the appender should return true.

#### Returns

`boolean`
`public string` | # `getName( )` Retruns the appender name. Retruns the appender name.

#### Returns

`string`
`public` | # `setName( string $name )` Sets the appender name. Sets the appender name.

#### Parameters

$name
  `string`
  $name

`public `LoggerLevel`` | # `getThreshold( )` Returns the appender's threshold level. Returns the appender's threshold level.

#### Returns

``LoggerLevel``
`public` | # `setThreshold( `LoggerLevel`|string $threshold )` Sets the appender threshold. Sets the appender threshold.

#### Parameters

$threshold
  ``LoggerLevel`|string`
  $threshold Either a `LoggerLevel` object or a string equivalent.

#### See

LoggerOptionConverter::toLevel()
`public boolean` | # `isAsSevereAsThreshold( `LoggerLevel` $level )` Checks whether the message level is below the appender's threshold. Checks whether the message level is below the appender's threshold. If there is no threshold set, then the return value is always true.

#### Parameters

$level
  ``LoggerLevel``
  $level

#### Returns

`boolean`
Returns true if level is greater or equal than threshold, or if the threshold is not set. Otherwise returns false.
`public` | # `activateOptions( )` Prepares the appender for logging. Prepares the appender for logging. Derived appenders should override this method if option structure requires it.
`abstract protected` | # `append( `LoggerLoggingEvent` $event )` Forwards the logging event to the destination. Forwards the logging event to the destination. Derived appenders should implement this method to perform actual logging.

#### Parameters

$event
  ``LoggerLoggingEvent``
  $event

`public` | # `close( )` Releases any resources allocated by the appender. Releases any resources allocated by the appender. Derived appenders should override this method to perform proper closing procedures.
`protected` | # `warn( mixed $message )` Triggers a warning for this logger with the given message. Triggers a warning for this logger with the given message.

#### Overrides

`LoggerConfigurable::warn()`

Methods inherited from LoggerConfigurable
`setBoolean(), setFileSize(), setInteger(), setLevel(), setNumeric(), setPositiveInteger(), setString()`

Properties summary
`protected boolean` | $closed | `false` | # Set to true when the appender is closed. A closed appender will not accept any logging requests. Set to true when the appender is closed. A closed appender will not accept any logging requests.
`protected `LoggerFilter`` | $filter | `` | # The first filter in the filter chain. The first filter in the filter chain.
`protected `LoggerLayout`` | $layout | `` | # The appender's layout. Can be null if the appender does not use a layout. The appender's layout. Can be null if the appender does not use a layout.
`protected string` | $name | `` | # Appender name. Used by other components to identify this appender. Appender name. Used by other components to identify this appender.
`protected `LoggerLevel`` | $threshold | `` | # Appender threshold level. Events whose level is below the threshold will not be logged. Appender threshold level. Events whose level is below the threshold will not be logged.
`protected boolean` | $requiresLayout | `true` | # Set to true if the appender requires a layout. Set to true if the appender requires a layout. True by default, appenders which do not use a layout should override this property to false.