Logging to file with ajax requests

Hi, everyone

I’m unable to log a message to an application.log when I do it in ajax-requested action

So I have




public function actionLoad($limit = 5, $lastNoteId = null)

{

	Yii::log('ajax','info');

	if (Yii::app()->request->isAjaxRequest) {

		// echo "something";

	}

}



When I run this code via browser, it logs normally, but when I call it through ajax request, there is no log message in application log.

My config is




'log'=>array(

	'class'=>'CLogRouter',

	'routes'=>array(

		array(

			'class'=>'CFileLogRoute',

			'levels'=>'info, error, warning',

		),

	),

),



So, how to enable logging for ajax request?

I found another topic on the forum about the same problem, but it’s for 1.0.x, while I’m using 1.1.7

That is true, that if I use CWebLogRoute, then ajax logging should be enabled additionally, but what’s with CFileLogRoute? Any file file output will never make ajax request fail!

Write in controller




Yii::log('ajax','info');



in configuration




'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'info, error, warning',

                	'filter'=>'CLogFilter',

				),

........



Tried, but this changed nothing, still no message in the log with ajax requests…

Perhaps add Yii::app()->end() to ajax handling code, at least in case of no call to one of the render*() methods.

/Tommy

note differences in config file.

filter’=>‘CLogFilter’,

tri and R.K.

Thanks for quick replies

It seems that the problem was in my code…

I commented all other code in the action, except Yii::log(); and it worked fine.

Seems that there is some error in the code, which is displayed nowhere

OK :)