Notify admin when errors occur
Switch branches/tags
Clone or download
Pull request Compare This branch is 2 commits behind splitfeed:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Error Notifier

The error notifier is (for now) a single method for generating and mailing the latest logs to a specified e-mail account. Each time it runs it compiles the logs since the last run and composes an email of it. Any repeated lines will be concatenated and marked as "[Repeated x times]" to increase readability.


The config/error_notifier.php contains settings for the e-mail being sent and must be configured before use.

sender_email, sender_name and recipient

Sets sender and recipient of the log emails


Determines if empty mails should be sent or not. Sending of empty mails are useful to see that monitoring is still functioning, but that no log entries have appeared since last time.


The equivalent of the common CI configuration entry, but here it specifies a filter to apply on the log before mailing.


The error notifier keeps a state file with a timestamp in it to keep track of when the logs last were mailed. This file is by default saved in the logfolder and is named ".notifier_state".


Makes the warning level colored and the "Repeated x times" a lighter gray for readability. Any suggestions here are welcome, readability is one of the most important aspects of these mails!


Trim the base path of CI from all paths for shorter messages. The full paths are always available in the real log file.


Send all messages without html tags

CI v1.x installation

For old Codegniter you should install this spark manually:

  1. add error_notifier into autoload.php in your application config folder like:

    $autoload['libraries'] = array('error_notifier');

  2. put error_notifier.php (library) into your application libraries folder

  3. put error_notifier.php (config) into your application config folder

  4. set up a controller (see below)


Set up a controller something like this:

class Cronjob extends CI_Controller {
	public function send_logs() {

Using with postmark spark:

class Cronjob extends CI_Controller {
    public function send_logs() {

For CI v1.x a controller will be like this:

class Cronjob extends CI_Controller {
    public function send_logs() {

Then visit it with a browser to make sure it works, then setup a cron job on your server to run it continuously.



  • Added plain option to send non html messages
  • Added compatibility with log_path option from main CI config file


  • Added colorize option for coloring the mail
  • Added shorten_paths option for trimming base path from all errors since it's always the same anyway


  • Moved default notifier state file and made location configurable
  • Removed an error message if nothing had been logged


  • Added support for filtering
  • Fixed bug in state file saving


  • Initial release


  • Improved filtering
  • More readable log mails