Alvaro
Alvaro

Reputation: 41595

Avoid recording errors and debug logs on CakePHP 2

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?

Upvotes: 1

Views: 3080

Answers (1)

JJJ
JJJ

Reputation: 33163

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.

Upvotes: 3

Related Questions