sfErrorNotifierPlugin - 1.5.1

Sends email notifications when application errors (exceptions) occur.

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 | Show as Markdown

sfErrorNotifierPlugin plugin

The sfErrorNotifierPlugin sends automatically email notifications when application errors (exceptions) occur and are not caught.

Its easy configuration allows you to set which environments to enable for the notifications.

The details about the thrown exceptions and other useful parameteers are sent via email.

NEW! It is also possible to trigger notifications explicitly by using this line from anywhere in your code (the email will be sent only from the environments enabled for the notifications):

      sfErrorNotifier::alert('Message To Send With The Alert')   

NEW! You can specify a mailer function (or method) to use rather than the native PHP mail method

NEW! It work on Symfony 1.2, 1.3 and 1.4

Installation

  • Install the plugin

      symfony plugin:install sfErrorNotifierPlugin
    
  • In the file /plugins/sfErrorNotifierPlugin/config/app.yml, set the email address(es) to deliver the notifications to, for the environments you want to enable (tipically only 'prod'). You can comma-separate multiple recipients.

      prod:
        sfErrorNotifier:
          emailTo:      errors@mysite.com
    

In this configuration file, you can also set the format of the email (html or txt) and, optionally, the From: field for the email.

  • Clear the cache

      symfony cc
    
  • Should you have any problem running the previous command, just delete the files in the cache directory manually

  • Some users have mentioned they needed to override the default error page in order to get this plugin to work. You shouldn't need that, but just in case the plugin doesn't work, try to do it. The way to set a custom error page is explained in the Symfony books.

  • You're done.

Changelog

2010-08-05 | 1.5

  • works with Symfony 1.4 (thanks to luctus)
  • it should alert also for PHP fatal errors (such as memory exausted) (thanks to maksim_ka)
  • fixed a bug: under certain conditions, the $user variable wasn't an object and that was triggering a Fatal Error
  • you can specify a mailer function (or method) to use rather than the native PHP mail method
  • the notification now also contains some further details for the request
  • the notification now also contains the name of the application
  • tested on Symfony 1.2, 1.3 and 1.4

2010-03-23 | 1.2

  • Fixed a bug in the documentation
  • Made the code a bit more robust

2009-10-28 | 1.1

  • Added nice HTML format for the email (thanks to Gustavo Garcia)
  • Added user information to the email (thanks to Gustavo Garcia)
  • Added the possibility to also trigger the notification email explicitly via a standard method call

2009-04-30 | 1.0.2

  • Improved the documentation
  • Made the email subject more explanatory

2009-04-27 | 1.0.1

  • Improved the documentation

2009-04-26 | 1.0.0

  • converted the plugin to 1.1