Here is an example of a class called ULLog, which is contained in the code download sample, that will keep this functinality more contained, simple to use and leverage the failed request queue. To use the ULLog new it up when the application starts up with your Access Key, Secret Key and Submission Url.