Class LoggerAppenderSyslog

Description

Log events to a system log using the PHP syslog() function.

This appenders requires a layout.

## Configurable parameters: ##

  • **ident** - The ident of the syslog message.
  • **priority** - The priority for the syslog message (used when overriding priority).
  • **facility** - The facility for the syslog message
  • **overridePriority** - If set to true, the message priority will always use the value defined in $priority, otherwise the priority will be determined by the message's log level.
  • **option** - The option value for the syslog message.
Recognised syslog options are:

  • CONS - if there is an error while sending data to the system logger, write directly to the system console
  • NDELAY - open the connection to the logger immediately
  • ODELAY - delay opening the connection until the first message is logged (default)
  • PERROR - print log message also to standard error
  • PID - include PID with each message
Multiple options can be set by delimiting them with a pipe character, e.g.: "CONS|PID|PERROR".

Recognised syslog priorities are:

  • EMERG
  • ALERT
  • CRIT
  • ERR
  • WARNING
  • NOTICE
  • INFO
  • DEBUG
Levels are mapped as follows:

  • FATAL to LOG_ALERT
  • ERROR to LOG_ERR
  • WARN to LOG_WARNING
  • INFO to LOG_INFO
  • DEBUG to LOG_DEBUG
  • TRACE to LOG_DEBUG

Located in /log4php/appenders/LoggerAppenderSyslog.php (line 72)

LoggerConfigurable
   |
   --LoggerAppender
      |
      --LoggerAppenderSyslog
Variable Summary
string $facility
string $ident
string $option
string $priority
Method Summary
void activateOptions ()
void append (LoggerLoggingEvent $event)
void close ()
string getFacility ()
string getIdent ()
string getOption ()
string getPriority ()
void setFacility (string $facility)
void setIdent (string $ident)
void setOption (string $option)
void setOverridePriority (string $overridePriority)
void setPriority (string $priority)
Variables
string $facility = 'USER' (line 101)

The facility value indicates the source of the message.

  • access: protected
string $ident = "Apache log4php" (line 79)

The ident string is added to each message. Typically the name of your application.

  • access: protected
string $option = 'PID|CONS' (line 94)

The option used when opening the syslog connection.

  • access: protected
string $overridePriority = false (line 110)

If set to true, the message priority will always use the value defined in $priority, otherwise the priority will be determined by the message's log level.

  • access: protected
string $priority (line 87)

The syslog priority to use when overriding priority. This setting is required if overridePriority is set to true.

  • access: protected

Inherited Variables

Inherited from LoggerAppender

LoggerAppender::$closed
LoggerAppender::$filter
LoggerAppender::$layout
LoggerAppender::$name
LoggerAppender::$requiresLayout
LoggerAppender::$threshold
Methods
activateOptions (line 221)
  • access: public
void activateOptions ()

Redefinition of:
LoggerAppender::activateOptions()
Prepares the appender for logging.
append (line 245)

Appends the event to syslog.

Log is opened and closed each time because if it is not closed, it can cause the Apache httpd server to log to whatever ident/facility was used in openlog().

  • see: 97843
  • access: public
void append (LoggerLoggingEvent $event)

Redefinition of:
LoggerAppender::append()
Forwards the logging event to the destination.
close (line 229)
  • access: public
void close ()

Redefinition of:
LoggerAppender::close()
Releases any resources allocated by the appender.
getFacility (line 198)

Returns the 'facility' parameter.

  • access: public
string getFacility ()
getIdent (line 180)

Returns the 'ident' parameter.

  • access: public
string getIdent ()
getOption (line 216)

Returns the 'option' parameter.

  • access: public
string getOption ()
getOverridePriority (line 207)

Returns the 'overridePriority' parameter.

  • access: public
string getOverridePriority ()
getPriority (line 189)

Returns the 'priority' parameter.

  • access: public
string getPriority ()
setFacility (line 153)

Sets the $facility.

  • access: public
void setFacility (string $facility)
  • string $facility
setIdent (line 135)

Sets the $ident.

  • access: public
void setIdent (string $ident)
  • string $ident
setOption (line 171)

Sets the 'option' parameter.

  • access: public
void setOption (string $option)
  • string $option
setOverridePriority (line 162)

Sets the $overridePriority.

  • access: public
void setOverridePriority (string $overridePriority)
  • string $overridePriority
setPriority (line 144)

Sets the $priority.

  • access: public
void setPriority (string $priority)
  • string $priority

Inherited Methods

Inherited From LoggerAppender

LoggerAppender::__construct()
LoggerAppender::activateOptions()
LoggerAppender::addFilter()
LoggerAppender::append()
LoggerAppender::clearFilters()
LoggerAppender::close()
LoggerAppender::doAppend()
LoggerAppender::getDefaultLayout()
LoggerAppender::getFilter()
LoggerAppender::getFirstFilter()
LoggerAppender::getLayout()
LoggerAppender::getName()
LoggerAppender::getThreshold()
LoggerAppender::isAsSevereAsThreshold()
LoggerAppender::requiresLayout()
LoggerAppender::setLayout()
LoggerAppender::setName()
LoggerAppender::setThreshold()
LoggerAppender::warn()
LoggerAppender::__destruct()

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:33 +0900 by phpDocumentor 1.4.4