Class LoggerAppender

Description

Abstract class that defines output logs strategies.

  • version: $Revision: 1374777 $
  • abstract:

Located in /log4php/LoggerAppender.php (line 27)

LoggerConfigurable
   |
   --LoggerAppender
Direct descendents
Class Description
LoggerAppenderPDO LoggerAppenderPDO appender logs to a database using the PHP's PDO extension.
LoggerAppenderMail LoggerAppenderMail appends log events via email.
LoggerAppenderMongoDB Appender for writing to MongoDB.
LoggerAppenderSyslog Log events to a system log using the PHP syslog() function.
LoggerAppenderEcho LoggerAppenderEcho uses the PHP echo() function to output events.
LoggerAppenderSocket LoggerAppenderSocket appends to a network socket.
LoggerAppenderConsole LoggerAppenderConsole appends log events either to the standard output stream (php://stdout) or the standard error stream (php://stderr).
LoggerAppenderNull A NullAppender merely exists, it never outputs a message to any device.
LoggerAppenderFile LoggerAppenderFile appends log events to a file.
LoggerAppenderPhp LoggerAppenderPhp logs events by creating a PHP user-level message using the PHP's trigger_error()function.
LoggerAppenderFirePHP Logs messages as HTTP headers using the FirePHP Insight API.
LoggerAppenderMailEvent LoggerAppenderMailEvent appends individual log events via email.
Variable Summary
Method Summary
LoggerAppender __construct ([string $name = ''])
void __destruct ()
void activateOptions ()
void addFilter (LoggerFilter $filter)
void append (LoggerLoggingEvent $event)
void clearFilters ()
void close ()
void doAppend (LoggerLoggingEvent $event)
string getName ()
boolean requiresLayout ()
void setLayout (LoggerLayout $layout)
void setName (string $name)
void setThreshold (LoggerLevel|string $threshold)
void warn ( $message)
Variables
boolean $closed = false (line 34)

Set to true when the appender is closed. A closed appender will not accept any logging requests.

  • access: protected
LoggerFilter $filter (line 40)

The first filter in the filter chain.

  • access: protected
LoggerLayout $layout (line 47)

The appender's layout. Can be null if the appender does not use a layout.

  • access: protected
string $name (line 53)

Appender name. Used by other components to identify this appender.

  • access: protected
boolean $requiresLayout = true (line 70)

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.

  • access: protected

Redefined in descendants as:
LoggerLevel $threshold (line 60)

Appender threshold level. Events whose level is below the threshold will not be logged.

  • access: protected
Methods
Constructor __construct (line 76)

Default constructor.

  • access: public
LoggerAppender __construct ([string $name = ''])
  • string $name: Appender name

Redefined in descendants as:
Destructor __destruct (line 84)
  • access: public
void __destruct ()
activateOptions (line 257)

Prepares the appender for logging.

Derived appenders should override this method if option structure requires it.

  • access: public
void activateOptions ()

Redefined in descendants as:
addFilter (line 102)

Adds a filter to the end of the filter chain.

  • access: public
void addFilter (LoggerFilter $filter)
append (line 268)

Forwards the logging event to the destination.

Derived appenders should implement this method to perform actual logging.

  • abstract:
  • access: protected
void append (LoggerLoggingEvent $event)

Redefined in descendants as:
clearFilters (line 113)

Clears the filter chain by removing all the filters in it.

  • access: public
void clearFilters ()
close (line 276)

Releases any resources allocated by the appender.

Derived appenders should override this method to perform proper closing procedures.

  • access: public
void close ()

Redefined in descendants as:
doAppend (line 141)

Performs threshold checks and invokes filters before delegating logging to the subclass' specific append() method.

void doAppend (LoggerLoggingEvent $event)
getDefaultLayout (line 94)

Returns the default layout for this appender. Can be overriden by derived appenders.

  • access: public
LoggerLayout getDefaultLayout ()

Redefined in descendants as:
getFilter (line 122)

Returns the first filter in the filter chain.

The return value may be null if no is filter is set.

  • access: public
LoggerFilter getFilter ()
getFirstFilter (line 131)

Returns the first filter in the filter chain.

The return value may be null if no is filter is set.

  • access: public
LoggerFilter getFirstFilter ()
getLayout (line 175)

Returns the appender layout.

  • access: public
LoggerLayout getLayout ()
getName (line 204)

Retruns the appender name.

  • access: public
string getName ()
getThreshold (line 220)

Returns the appender's threshold level.

  • access: public
LoggerLevel getThreshold ()
isAsSevereAsThreshold (line 244)

Checks whether the message level is below the appender's threshold.

If there is no threshold set, then the return value is always true.

  • return: Returns true if level is greater or equal than threshold, or if the threshold is not set. Otherwise returns false.
  • access: public
boolean isAsSevereAsThreshold (LoggerLevel $level)
requiresLayout (line 196)

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.

  • access: public
boolean requiresLayout ()
setLayout (line 165)

Sets the appender layout.

  • access: public
void setLayout (LoggerLayout $layout)
setName (line 212)

Sets the appender name.

  • access: public
void setName (string $name)
  • string $name
setThreshold (line 231)

Sets the appender threshold.

  • see: LoggerOptionConverter::toLevel()
  • access: public
void setThreshold (LoggerLevel|string $threshold)
warn (line 281)

Triggers a warning for this logger with the given message.

  • access: protected
void warn ( $message)
  • $message

Redefinition of:
LoggerConfigurable::warn()
Triggers a warning.

Inherited Methods

Inherited From LoggerConfigurable

LoggerConfigurable::setBoolean()
LoggerConfigurable::setFileSize()
LoggerConfigurable::setInteger()
LoggerConfigurable::setLevel()
LoggerConfigurable::setNumeric()
LoggerConfigurable::setPositiveInteger()
LoggerConfigurable::setString()
LoggerConfigurable::warn()

Documentation generated on Thu, 16 Feb 2017 18:02:05 +0900 by phpDocumentor 1.4.4