PHP error reporting with Sentry
We’ve recently been working on improving our support in various clients, and in the latest round of changes that focus has been on PHP error tracking.
While many of us have moved on to other languages, such as Python and Ruby, the PHP community is still extremely large. We’re hoping to engage more of that community by bettering the tools.
We extract as much as much information as possible for later debugging. If you’ve ever seen Django error tracking, you’ll feel right at home with the improvements on typical PHP trace displays that Sentry offers. Frame to function and source code context make it easier than ever to debug your application.
Additionally we’ve expanded the source context around each frame so that you’ll never need to question which part of your code an error originated in.
One of our favorite additions is simple function calling context using the PHP reflection APIs. With this we’re able to expand arguments passed into a function to ease debugging and future reproduction of events.
This kind of context is invaluable for the likes of Python error tracking, and even though we’re not able to offer as much of a deep dive, we think this information is an excellent improvement.
We’ve recently added tagging support to events. These are simple key/value pairs to describe an event, and generally resemble things like the server hostname or a webpage URL. While these have existed for quite a while, and would automatically be pulled in, you can now specify your own tags with events.
For example, if you wanted to automatically pass up the php version as a tag, you could do so via the client level configuration:
$client = new Raven_Client('http://public:email@example.com/1', array( 'tags' => array( 'php_version' => phpversion() ), ));
Once you start sending tags you’ll notice that you can filter events based on the value of those, as well as see the frequency within an event.
More to come
We’ll be making even more improvements in the future, and we’re really hoping to modernize how people debug production errors, both in the PHP community, and in web applications as a whole.
If you haven’t yet tried out Sentry for PHP exception handling, give it a shot. After all, it only costs you a few minutes of your time. Already a happy customer? We’d love to hear about your success (leave us a comment)!
For more information check out the PHP client documentation and see what you’ve been missing! Don’t forget, Sentry, and most importantly the PHP client are both open source. If you’re interested in improving support for the platform, head on over to the GitHub repository for raven-php.