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…
pestaa
(Pestaa)
September 15, 2009, 10:38pm
2
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.
twtech
(Tedwebtech)
August 12, 2010, 8:02am
3
Hi guys!
I need more detailed info on this topic. I’ve done the following:
index.php:
Yii::beginProfile('overall', 'profiler');
Yii::createWebApplication($config)->run();
Yii::endProfile('overall', 'profiler');
in config:
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
array(
'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!
mikl
(Mike)
August 12, 2010, 11:22am
4
twtech
(Tedwebtech)
August 12, 2010, 11:28am
5
Sure thing:) But it says how to get a web output. And I want the info to be logged into the file
mikl
(Mike)
August 12, 2010, 11:40am
6
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".
twtech
(Tedwebtech)
August 12, 2010, 11:51am
7
Tried right now. Still nothing.
Gonna write my own route, with blackjack and other stuff
Mike, thanks for the reply!
mikl
(Mike)
August 12, 2010, 11:55am
8
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…