Friday, June 13, 2014

FileLog: error when renaming the filelog

Hi,
I write an rest api that receive many request per seconds. I'm logging all the response (api_error, api_success, api_warning, api_info...) in the same specific log (api.log).

The only override in the CakeLog::config() is: 'rotate' => 20 and there is a load balancing on the prod env.

The questions is: when the FileLog rotate the file log (rename api.log to api.log.<timestamp>), sometimes the following error occurs:

This is a real error message:
Message: rename(/data/nuvem/api/cakephp-2.5.0/app/tmp/logs/api.log,/data/nuvem/api/cakephp-2.5.0/app/tmp/logs/api.log.1402657623) [function.rename]: No such file or directory

I think that, because there are too many requests, the FileLog loses the file pointer (I think) for another request/thread. How it's possible?

why this error happens? Can anyone explain this error?

PS. I try to validate a $filepath in _rotateFile() function (lib/cake/Log/Engine/FileLog.php) to solve it.

Sorry for my english ;)

Thanks,
Fabrício


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: