简体   繁体   English

CakePHP:发送崩溃电子邮件

[英]CakePHP: Send emails for crashes

What's the best way to add email notifications for CakePHP crashes? 为CakePHP崩溃添加电子邮件通知的最佳方法是什么? I want to be emailed with a stacktrace whenever a fatal error occurs, so that I can know immediately instead of checking the logs. 每当发生致命错误时,我都希望通过电子邮件发送stacktrace,以便我可以立即知道而不是检查日志。

I looked at overriding AppController::appError(); 我看着覆盖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 https://github.com/CakeDC/utils/blob/develop/Error/EmailErrorHandler.php

It is a customized error handler for CakePHP. 它是CakePHP的自定义错误处理程序。 You need to configure CakePHP to use that error handler class. 您需要配置CakePHP以使用该错误处理程序类。 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. 我对核心的拉取请求被拒绝,该请求在handleError()方法中引入了一个事件……那里的一个事件将使处理这样的用例变得非常容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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