sfSyslogLoggerPlugin - 0.9.0

A syslog logger plugin.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

Introduction

The sfSyslogLoggerPlugin provides a logger that sends all messages to syslog.

How to use

Install the plugin and add the logger to your app/*/config/factories.yml. To active the syslog logger ("sf_syslog_debug"), deactivate the standard file logger ("sf_file_debug") and leave the web debug toolbar logger untouched, use this:

logger:
  class: sfAggregateLogger
  param:
    loggers:
      sf_syslog_debug:
        class: sfSyslogLogger
        param:
          facility: LOG_USER
      sf_file_debug:
        class: sfNoLogger

Configuration

The following things can be configured as "param" like in the above example:

  • level: The threshold level below which Symfony discards the message.
  • ident: The syslog ident string, usually the "programm's name", defaults to the name of the current Symfony application.
  • facility: The Syslog Facility as described in PHP's openlog() function. The default is LOG_USER. Can be written as string or using as PHP constant like .
  • options: Any combination of the options described in PHP's openlog() function Can be written as "LOG_PID | LOG_PERROR" or using PHP constants like

Caveat

The PHP syslog() is said to be not thread safe and does not use separate handles i.e. the ident and facility strings affect the whole process. Even Apache's own error log, if configured to syslog, will start logging to your facility. Wrapping syslog() by immediate calls to openlog() and closelog() mitigates this.

Contact

Christian Hammers ch@lathspell.de