Troubleshooting AJAX Server-side

22 views
Skip to first unread message

ashore

unread,
May 2, 2016, 10:35:17 AM5/2/16
to Professional PHP Developers
All, given ubiquitous AJAX with PHP, I wonder what techniques are popular among you folks in catching errors.

I have no problem catching these during the development phase.  But production has been a bear when these surface; they need to be caught and information retained for investigation.

Some of our users are running off localhost, where emailing notifications won't work, while others are remote-hosted.  Which may constrain the techniques. 

All suggestions appreciated.

Robert Gonzalez

unread,
May 2, 2016, 4:10:10 PM5/2/16
to professional-php
What I've taken to recently is logging all exceptions that are thrown by the application. This is predicated on you having exceptions and using them correctly, but in general, what I've done is add a factory class for constructing my exceptions and, inside of that factory method, log the same thing that the exception is setting as its message. This would allow your clients to easily upload a text file for your review, as well as giving you the option later of exposing the log by way of a log view so that your users could search the text for meaningful data.

--
This group is managed by the web application development team at www.360psg.com
---
You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to professional-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/professional-php.
To view this discussion on the web visit https://groups.google.com/d/msgid/professional-php/81574325-cc2d-4390-a130-1612c9391dfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Robert Gonzalez
   

David Dyess

unread,
May 2, 2016, 10:01:04 PM5/2/16
to professional-php

What I've been using is a class that is a custom error handler, which kills itself and falls back if it has an error itself. I set it with set_error_handler(). What it does is log the error data to a log file (could be a database) and put it behind my built-in permissions system so only privileged users will get a notification icon when an error is recorded. I md5 the error, use that to create an ID and subsequent errors tick a counter instead of logging repeat messages.

This is still fairly new, but I have found it really useful. I did the same with exceptions a while back, but recently built-in the complete error handling.


Reply all
Reply to author
Forward
0 new messages