Class LoggerAppenderSyslog

Description

Log events using php http://www.php.net/syslog function.

This appender can be configured by changing the following attributes:

  • layout - Sets the layout class for this appender
  • ident - Set the ident of the syslog message.
  • priority - Set the priority value for the syslog message.
  • facility - Set the facility value for the syslog message
  • overridePriority - If the priority of the message to be sent can be defined by a value in the properties-file, set parameter value to "true"
  • option - Set the option value for the syslog message. This value is used as a parameter for php openlog() and passed on to the syslog daemon.
Levels are mapped as follows:
  • level >= FATAL to LOG_ALERT
  • FATAL > level >= ERROR to LOG_ERR
  • ERROR > level >= WARN to LOG_WARNING
  • WARN > level >= INFO to LOG_INFO
  • INFO > level >= DEBUG to LOG_DEBUG
An example:

  1. require_once dirname(__FILE__).'/../../main/php/Logger.php';
  2.  
  3. Logger::configure(dirname(__FILE__).'/../resources/appender_syslog.properties');
  4. $logger Logger::getRootLogger();
  5. $logger->fatal("Hello World!");

  1. log4php.appender.default = LoggerAppenderSyslog
  2. log4php.appender.default.layout = LoggerLayoutSimple
  3. log4php.appender.default.ident = log4php-test
  4. log4php.appender.default.facility = LOG_LOCAL0
  5. log4php.rootLogger = DEBUG, default

  • version: $Revision: 883108 $

Located in /appenders/LoggerAppenderSyslog.php (line 54)

LoggerAppender
   |
   --LoggerAppenderSyslog
Method Summary
LoggerAppenderSyslog __construct ([ $name = ''])
void __destruct ()
void activateOptions ()
void append (LoggerLoggingEvent $event)
void close ()
void setDry ( $dry)
void setFacility (const $facility)
void setIdent (string $ident)
void setOption (string $option)
void setOverridePriority (bool $overridePriority)
void setPriority (const $priority)
Variables
Methods
Constructor __construct (line 99)
  • access: public
LoggerAppenderSyslog __construct ([ $name = ''])
  • $name

Redefinition of:
LoggerAppender::__construct()
Constructor
Destructor __destruct (line 104)
  • access: public
void __destruct ()
activateOptions (line 161)
  • access: public
void activateOptions ()

Redefinition of:
LoggerAppender::activateOptions()
Derived appenders should override this method if option structure requires it.
append (line 174)
  • access: public
void append (LoggerLoggingEvent $event)

Redefinition of:
LoggerAppender::append()
Subclasses of LoggerAppender should implement this method to perform actual logging.
close (line 167)
  • access: public
void close ()

Redefinition of:
LoggerAppender::close()
Release any resources allocated.
setDry (line 108)
  • access: public
void setDry ( $dry)
  • $dry
setFacility (line 136)

Set the facility value for the syslog message.

  • access: public
void setFacility (const $facility)
  • const $facility: int Facility
setIdent (line 117)

Set the ident of the syslog message.

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

Set the option value for the syslog message.

This value is used as a parameter for php openlog() and passed on to the syslog daemon.

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

If the priority of the message to be sent can be defined by a value in the properties-file, set parameter value to "true".

  • access: public
void setOverridePriority (bool $overridePriority)
  • bool $overridePriority: Override priority
setPriority (line 126)

Set the priority value for the syslog message.

  • access: public
void setPriority (const $priority)
  • const $priority: int Priority

Inherited Methods

Inherited From LoggerAppender

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

Documentation generated on Fri, 27 Nov 2009 07:44:48 +0100 by phpDocumentor 1.4.3