避免在CakePHP 2上记录错误和调试日志 [英] Avoid recording errors and debug logs on CakePHP 2

查看:95
本文介绍了避免在CakePHP 2上记录错误和调试日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个只有200Mb空间的小型托管,并且放置在App / tmp / logs中的error.log和debug.log文件的大小非常快。现在他们的大小约为120Mb。

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.

我每2分钟使用一次cron作业,这可能是其原因。

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?

推荐答案

并删除调试语句,以便不会在日志中写入任何内容。要按字面回答问题,您可以配置错误处理程序不在core.php中记录任何内容:

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
));

或者,由于您每2分钟运行一次cron作业,时间。

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

这篇关于避免在CakePHP 2上记录错误和调试日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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