On Thu, Oct 22, 2009 at 7:29 PM, Jules Piccotti <[email protected]> wrote:
> While I agree on Jurian's comment about the availability of a logger > in most areas of a project, I don't think that any implementation > should really take place in the models... > > Really? Could you say more about this? Do you mean that the model should have no interaction with a logger? If so, why? > 2009/10/18 gerardroche <[email protected]>: > > > > > >>It is an elegant solution, but you're not able to log inside models, view > >>helpers and/or resource plugins. I have for example a User model which is > > able > >>to do the authentication with Zend_Auth. $model->authenticate() and if > > you're > >>using the wrong credentials it is logged. > >> > >>I have a resource plugin for my db, checking if the db is connected > > correctly. > >>If not, I log a message, which is emailed to me directly. > >> > >>What about those things? I think the controllers aren't the only objects > in > >>which you want to log something :) > > > > I have a similar problem, but there are many options, it's a case of > using > > what is right for your project. > > > > You could add setters and getters to your models and attach the logger to > > your models in the controller. > > > > You could also create a static setter method on a parent model to all > your > > project models and set the logger to the base model which would then be > > available to all your models, very similar to the way > Zend_Db_Table_Abstract > > allows you to set a default adapter. I like this one though it does have > its > > caveats. > > > > There are othe options too. > > > > > > > > -- > > View this message in context: > http://www.nabble.com/How-to-make-a-global-Zend_Log-with-Zend_Application_Bootstrap-tp25841362p25948877.html > > Sent from the Zend Framework mailing list archive at Nabble.com. > > > > >
