How do you log php errors with CakePHP when debug is 0?

我是研究僧i 提交于 2019-12-04 14:49:48

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.

define('LOG_ERROR', 2); in core.php

PHP should log errors to its own logfile, regardless of what CakePhp is doing.

Look in /etc/php.ini file (or wherever yours lives) and search for error_log. This will show you where the PHP log resides on your system.

There is a bug in CakePHP 1.2-1.3 where PHP errors/warnings are suppressed in view code when debugging is disabled.

In the file cake/libs/view/view.php on line #664 it reads

@include ($___viewFn);

But the @ directive suppresses errors for the entire view handler. Instead it should be:

include ($___viewFn);

Which allows PHP errors/warnings to be generated in view code and subsequently get logged. Once I changed this and had the right logging settings in core.php I was finally able to get complete logs in production.

Sometime the reason could be very different. For example the framework you are using may have its own internal caching module which keeps the value in buffer while you keep on trying. Check whether duplicate copies are getting generated or not. Typically those files would be named as filename.ext.r123 and so on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!