1

I am running a site on Ubuntu with Apache and using PHP and Zend Framework.

I would like exception information emailed to the devs and am wondering about a good way to do this. I don't want to email every single exception right away because if something major happens, our inboxes will get flooded.

Instead, I am looking for a way that the exceptions and errors from the past hour can be emailed all at once (up to a certain size limit). I am thinking about writing a cron script to parse Apache's error_log but perhaps there are easier ways than doing that.

Matt McCormick
  • 13,041
  • 22
  • 75
  • 83
  • Releated, although possibly not an exact match, but ought to be of help to future searchers ... http://softwarerecs.stackexchange.com/questions/39001/generic-configurable-php-probem-error-exception-handler-which-emails-me-a-rep – Mawg says reinstate Monica Jan 25 '17 at 18:29

4 Answers4

2

I'd recommend Hoptoad: http://hoptoadapp.com/pages/home

Ahmed Nuaman
  • 12,662
  • 15
  • 55
  • 87
1

I work on a open source project. It's a ticket tracker that can receive error reports from any other PHP app, can detect duplicates to avoid email floods and email developers.

Look at http://elastik.sf.net/ and the "ErrorReportingService" module.

Version 0.3.1 is coming in several days with big improvements to the error collecting mechanisms.

Sample of an error report is at http://jarofgreen.wordpress.com/2011/01/30/tracking-errors-with-php/

James
  • 3,265
  • 4
  • 22
  • 28
  • Or if you want to roll your own, I did want to link to the relevant file in our sourceforge repository but it seems to be having problems ... check out the trunk of our app and look at mod.ErrorReportingService/includes/RemoteReportingWidget.php – James Feb 01 '11 at 21:02
0

If you're not interested in hosted solutions, and already using the Zend Framework, it shouldn't be too hard to write the errors to a special database or log, and have a periodically run process send the aggregated information.

As an example, my dayjob has an app that does this in a most stripped-down way: We use an extremely basic log (much like the apache logs), and a periodic process gets the content of the log, emails it, and truncates the file so that no old entries will be sent next time.

Of course, depending on how robust a solution you're looking for, you may want to go another route.

anonymous coward
  • 12,594
  • 13
  • 55
  • 97
0

I just give some links which I think should be useful.

Sets the default exception handler if an exception is not caught within a try/catch block. Execution will stop after the exception_handler is called.

Sets a user function (error_handler) to handle errors in a script.

Community
  • 1
  • 1
Alfred
  • 60,935
  • 33
  • 147
  • 186