Extending Zend_Log for application-specific need
I am building a Zend Framework application that performs jobs submitted by the user. The actions taken need to be logged to a database. I would like to correlate the job with its log entries.
Instead of creating my own logging class, I would like to extend Zend_Log sin开发者_如何学Pythonce it provides 99% of the functionality that I need. All I need to do is add a foreign key of the job id to the log data model.
Is this possible?
I'm also looking for a good example of Zend_Log writing to a database. I haven't searched SO yet. I will do that after I post this.
Thanks in advance...
Steve
It's certainly possible to extend Zend_Log
. The framework's code is open, and pretty clean. In the easiest case, you should be able to get going by creating a class in a new file that extends Zend_Log
.
Maybe one of our resident ZF experts can elaborate with more detailed info on how to do this in practice.
I'm also looking for a good example of Zend_Log writing to a database
Zend_Log already has a database connector. See here for an example.
精彩评论