CakePHP调试设置为0,但它仍在调试

时间:2013-02-15 09:29:06

标签: php debugging cakephp

我的蛋糕设置已将调试设置为0,但它仍在调试app / tmp / logs / debug.log。为了确保没有伏都教,我甚至打印出Configure :: read('debug')并吐出0.有人知道为什么会发生这种情况吗?以下是此调试日志的重复日志结果:

2013-02-15 01:25:41 Notice: Strict (2048): Non-static method App::_loadVendor() should not be called statically in [/var/www/website/htdocs/lib/Cake/Core/App.php, line 614]
Trace:
App::_loadVendor() - CORE/Cake/Core/App.php, line 614
App::import() - CORE/Cake/Core/App.php, line 614
include - APP/View/Helper/AdHelper.php, line 3
App::load() - CORE/Cake/Core/App.php, line 497
spl_autoload_call - [internal], line ??
class_exists - [internal], line ??
HelperCollection::load() - CORE/Cake/View/HelperCollection.php, line 75
View::loadHelpers() - CORE/Cake/View/View.php, line 577
View::render() - CORE/Cake/View/View.php, line 359
Controller::render() - CORE/Cake/Controller/Controller.php, line 898
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 114
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 89
[main] - APP/webroot/index.php, line 96

我也在使用PHP 5.4,并且正在运行CakePHP 2.3。

感谢。

2 个答案:

答案 0 :(得分:1)

确保完全(对于每个控制器和操作)关闭调试模式。在蛋糕core.php文件中试用此代码。

Configure::write('Error', array(
    'handler' => 'ErrorHandler::handleError',
    'level' => 0,
    'trace' => false
));

有关详细信息,请查看here

答案 1 :(得分:0)

如果将debug设置为0,则对debug()或Debugger :: log的任何调用都将写入debug.log(除非您已覆盖默认值)。然而,当调试大于0时,对debug()的调用将在浏览器中显示为flash消息(如果从模型或控制器调用,则在视图顶部,如果从View调用,则在内部)。

您可以在bootstrap.php中定义哪种类型的错误:

App::uses('CakeLog', 'Log');
CakeLog::config('debug', array(
    'engine' => 'FileLog',
    'types' => array('info', 'debug', 'notice'),
    'file' => 'debug',
));
CakeLog::config('error', array(
    'engine' => 'FileLog',
    'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
    'file' => 'error',
));

默认情况下,Cake在'debug'CakeLog :: config的types数组中放置'notice',这意味着通知会进入debug.log。将'notice'复制到'error'配置的types数组中,它应该将注意事项放在error.log中。