Profiling: formatted CProfileLogRoute report for Ajax requests?

For Ajax requests, the nice profiling report which CProfileLogRoute generates isn’t output anywhere. It’s not sent back with the response (for obvious reasons).

Can anyone tell me the easiest way to get this report sent to a log file instead, just for Ajax requests?

Many thanks…

beginProfile accepts a second parameter, category, which is ‘application’ by default. You can set it to ‘ajax’ and assign this category into another log route.

Hi guys!

I need more detailed info on this topic. I’ve done the following:


Yii::beginProfile('overall', 'profiler');


Yii::endProfile('overall', 'profiler');

in config:






			'levels'=>'error, warning',



			'class'=> 'CFileLogRoute',

			'categories' => 'profiler',




But all what I got in the log is this useless piece of info:

2010/08/12 08:11:35 [profile] [profiler] begin:overall

2010/08/12 08:11:38 [profile] [profiler] begin:overall

2010/08/12 08:11:39 [profile] [profiler] begin:overall

Help appreciated!

Did you check this?

Sure thing:) But it says how to get a web output. And I want the info to be logged into the file

Did you try to set the level to ‘profile’ too? Not sure, if this is supposed to work.

If not, you could still write your custom "ProfileFileLogRoute".

Tried right now. Still nothing.

Gonna write my own route, with blackjack and other stuff :)

Mike, thanks for the reply!

No problem.

Some ideas i had, how i’d approach this:

  • Extend from CProfileLogRoute

  • Override processLogs()

  • Use output buffering and call parent::processLogs() to capture profiling output

  • Peek at CFileLogroute::processLogs() to steal the code for writing to a log file

But i’m sure, there will be some pitfalls in this approach… ;)