当debug为0时,如何用CakePHP记录php错误? [英] How do you log php errors with CakePHP when debug is 0?

查看:186
本文介绍了当debug为0时,如何用CakePHP记录php错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个具有debug = 0的CakePHP网站上记录PHP错误。但是,即使我打开错误日志,像这样:

I would like to log PHP errors on a CakePHP site that has debug = 0. However, even if I turn on the error log, like this:

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
log_errors = On

不会记录错误。

问题是,即使一个解析错误,应该导致CakePHP环境不能完全加载(我认为),它仍然阻止错误被记录。如果我将debug设置为3,它会记录到文件没有问题。

The problem is that even for a parse error that should cause the CakePHP environment to not load completely (I think), it still blocks the error from being logged. If I set debug to 3, it logs to the file without issue.

我使用CakePHP 1.2。我知道这在1.3中显得更容易,但我还没准备好升级。

I am using CakePHP 1.2. I know this is apparently made easier in 1.3, but I'm not ready to upgrade.

推荐答案

和日志错误将使用裁判插件,因为它提供了一种方式来任意记录和捕获所有(包括致命的)错误。

Another way to keep track of and log errors would be to use the Referee plugin as it provides a way to arbitrarily log and catch all (including fatal) errors that occur during exection.

这篇关于当debug为0时,如何用CakePHP记录php错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆