简体   繁体   中英

CakePHP: Send emails for crashes

What's the best way to add email notifications for CakePHP crashes? I want to be emailed with a stacktrace whenever a fatal error occurs, so that I can know immediately instead of checking the logs.

I looked at overriding AppController::appError(); but I don't want to replace all of the exception handling.

Check this out, it is to long to paste here.

https://github.com/CakeDC/utils/blob/develop/Error/EmailErrorHandler.php

It is a customized error handler for CakePHP. You need to configure CakePHP to use that error handler class. My pull request to the core was rejected that introduced an Event in the handleError() method... An event there would make it really easy to handle use cases like this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM