Tracking WordPress Errors with Exceptional.io
July 6th, 2012
In my first few months at Forward, one of the coolest new features I encountered was the ability to track errors with a third-party service such as Airbrake or Exceptional.io, which are used by a number of our Ruby and Javascript based systems. Recently I’ve been working with a WordPress system that needs to scale to cope with high levels of traffic across multiple blogs, so I had a little investigation if there was a feasible.
Turns out Exceptional.io has a third-party PHP client that is incredibly simple to set up, even using WordPress: exceptional-php. Here are the steps I used to set it up:
- Sign for for a free 1-month trial on Exceptional.io, and retrieve your API key from the App Settings.
- Checkout the exceptional-php repo somewhere in your WordPress installation, I dropped in the root folder.
- Now we need to include and set up the library. To do this we are going to hook into the ‘init’ action with the code below. I placed this in my theme’s functions.php, but feel free to place this anywhere whether the add_action function is available (in a plugin for example):
1234add_action('init',function(){require(ABSPATH . '/exceptional/exceptional.php');Exceptional::setup('YOUR_API_KEY');}); - That should be it!
I recommend you find a way to produce an error on you local or development setup, Exceptional will record the error regardless. Once Exceptional tracks the error, you should get an e-mail for each new error message, which you can follow up on the online interface which provides a trace and list of sources for the error.NB: I have only tested this with WordPress 3.3+, but I imagine the PHP version matters more.
1 Response to Tracking WordPress Errors with Exceptional.io
Ben Arent
August 2nd, 2012 at 1:08 am
Thanks for the post Luke. This makes me think that we should setup an official wordpress plugin.