sasori
sasori

Reputation: 5463

how to log a specific controller's action in Yii framework and send it to email address?

how to log all the events happening in a Yii app's specific controller via a "txt file" or email ?, let's say I have this app made of Yii, now whenever there are users who use the site, I want a particular controller's actions to be logged and send it to me in email . such as the ,

so that i will know where exactly to look at whenever an error occured just incase am not around

Upvotes: 0

Views: 716

Answers (1)

soju
soju

Reputation: 25312

Yii logging feature is quite handy, did you read this : http://www.yiiframework.com/doc/guide/1.1/fr/topics.logging ?

You should configure CEmailLogRoute, for example :

array(
  'class'=>'CEmailLogRoute',
  'levels'=>'info',
  'emails'=>'[email protected]',
  'categories'=>'application.controller.YourController',
),

And in your controller actions, simply put :

Yii:log('message to log', 'info', 'application.controller.YourController');

Upvotes: 1

Related Questions