phpzend-frameworkloggingzend-log

Zend_Log in background - possible?


My Zend_Log writers are sending data to third-party resources, like Amazon DynamoDB, for example. Such operations take time and I want to do them in background. I tried to use pcntl_fork(), but it doesn't work correctly with Apache. Do you have any other ideas of how this parallel execution of logging operations can be done in PHP and in Zend Framework? Maybe some examples?

edit: I understand that an obvious solution would be to save log messages into some files/queue and push them through later, but this is not what I'm looking for in this question.


Solution

  • The right solution to this problem is to rely on syslog and Zend_Log_Writer_Syslog. Syslog decouples log clients from actual log writers (to any third-party resources). Writer to Amazon has to be configured as part of syslog server-side configuration.