Logging full NSException stack traces to your server

*UPDATE* I am using Crashlytics instead now and it’s awesome, go check it out!

Recently in You Doodle I discovered a couple of nasty crashes happening to users by looking in my Flurry Analytics error logs. Unfortunately flurry decides to truncate errors so you don’t get much useful out of it.

I decided I would write a logger to my own server and pass the full exception details. Here’s how I did it:

In my AppDelegate didFinishLaunching, I call this:

At the top of my AppDelegate.m file I have this function:

 

The logging to my server happens in DeviceLogRequest. Basically it does some magic and sends an http post request to a secure end point where the error details, including the full stack trace, are logged into my database for troubleshooting. You’ll still need to de-symbolicate crash addresses manually, but at least you will have the crash log!

Hopefully someone else finds this useful too!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.