Overview

Packages

  • log4php
    • appenders
    • configurators
    • filters
    • helpers
    • layouts
    • pattern
    • renderers

Classes

  • LoggerAppenderConsole
  • LoggerAppenderDailyFile
  • LoggerAppenderEcho
  • LoggerAppenderFile
  • LoggerAppenderFirePHP
  • LoggerAppenderMail
  • LoggerAppenderMailEvent
  • LoggerAppenderMongoDB
  • LoggerAppenderNull
  • LoggerAppenderPDO
  • LoggerAppenderPhp
  • LoggerAppenderRollingFile
  • LoggerAppenderSocket
  • LoggerAppenderSyslog
  • Overview
  • Package
  • Class
  • Tree

Class LoggerAppenderSyslog

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 LoggerAppenderSyslog::$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
LoggerConfigurable
Extended by LoggerAppender
Extended by LoggerAppenderSyslog
Package: log4php\appenders
License: Apache License, Version 2.0
Version: $Revision: 1337820 $
Link: Appender documentation
Located at appenders/LoggerAppenderSyslog.php
Methods summary
public
# setIdent( string $ident )

Sets the LoggerAppenderSyslog::$ident.

Sets the LoggerAppenderSyslog::$ident.

Parameters

$ident
string
$ident
public
# setPriority( string $priority )

Sets the LoggerAppenderSyslog::$priority.

Sets the LoggerAppenderSyslog::$priority.

Parameters

$priority
string
$priority
public
# setFacility( string $facility )

Sets the LoggerAppenderSyslog::$facility.

Sets the LoggerAppenderSyslog::$facility.

Parameters

$facility
string
$facility
public
# setOverridePriority( string $overridePriority )

Sets the LoggerAppenderSyslog::$overridePriority.

Sets the LoggerAppenderSyslog::$overridePriority.

Parameters

$overridePriority
string
$overridePriority
public
# setOption( string $option )

Sets the 'option' parameter.

Sets the 'option' parameter.

Parameters

$option
string
$option
public string
# getIdent( )

Returns the 'ident' parameter.

Returns the 'ident' parameter.

Returns

string
$ident
public string
# getPriority( )

Returns the 'priority' parameter.

Returns the 'priority' parameter.

Returns

string
public string
# getFacility( )

Returns the 'facility' parameter.

Returns the 'facility' parameter.

Returns

string
public string
# getOverridePriority( )

Returns the 'overridePriority' parameter.

Returns the 'overridePriority' parameter.

Returns

string
public string
# getOption( )

Returns the 'option' parameter.

Returns the 'option' parameter.

Returns

string
public
# activateOptions( )

Prepares the appender for logging.

Prepares the appender for logging.

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

Overrides

LoggerAppender::activateOptions()
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.

Overrides

LoggerAppender::close()
public
# append( LoggerLoggingEvent $event )

Appends the event to syslog.

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().

Parameters

$event
LoggerLoggingEvent
$event

See

http://www.php.net/manual/en/function.syslog.php#97843
Methods inherited from LoggerAppender
__construct(), __destruct(), addFilter(), clearFilters(), doAppend(), getDefaultLayout(), getFilter(), getFirstFilter(), getLayout(), getName(), getThreshold(), isAsSevereAsThreshold(), requiresLayout(), setLayout(), setName(), setThreshold(), warn()
Methods inherited from LoggerConfigurable
setBoolean(), setFileSize(), setInteger(), setLevel(), setNumeric(), setPositiveInteger(), setString()
Properties summary
protected string $ident "Apache log4php"
#

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

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

protected string $priority
#

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

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

protected string $option 'PID|CONS'
#

The option used when opening the syslog connection.

The option used when opening the syslog connection.

protected string $facility 'USER'
#

The facility value indicates the source of the message.

The facility value indicates the source of the message.

protected string $overridePriority false
#

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

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

Properties inherited from LoggerAppender
$closed, $filter, $layout, $name, $requiresLayout, $threshold
Apache log4php API documentation generated by ApiGen 2.8.0