Yii::app()->Controller->Id

Hello

I want to put every request in my log database

and do this

in config/main.php




'onBeginRequest'=> array('myClass','myMethod'),



in myClass




	public static function myMethod($event){

		$category = 'application';

		if(isset(Yii::app()->controller)) $category.='.'.str_replace('/','.',Yii::app()->controller->route);

		Yii::log('onbeginRequest', 'info', $category);

	}



but after execution PHP , $category is ‘application’ not ‘application.controller.action’

how can I do this ?

I want to run automatically this code




Yii::log('onbeginRequest', 'info', 'application.ModuleID.ControllerID.ActionID');



The onBeginRequest() method is called before the route has been resolved. You’ll need to override a different method, such as CController::beforeAction(). You would do that in your base Controller class.