Avoid recording errors and debug logs on CakePHP 2

删除回忆录丶 提交于 2019-12-02 09:58:42

问题


I am using an small hosting with only 200Mb of space and the error.log and debug.log files placed in "App/tmp/logs" are increasing in size very fast. Now their size is around 120Mb.

I am using a cron job every 2 minutes and it could be the cause of it.

I would like to disable the creation of both logs. How can I do it?


回答1:


The actual solution is to fix the errors and remove the debugging statements so that nothing would be written in the logs. To answer the question literally, you can configure the error handler to not log anything in core.php:

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

Or, since you're running a cron job every 2 minutes anyway, delete the logs at the same time.



来源:https://stackoverflow.com/questions/9851387/avoid-recording-errors-and-debug-logs-on-cakephp-2

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