Particletree.com Php Quick Profiler Wrapper
Its a Web Log Router that will help you profile your application, its database profiling feature allows you to quickly find duplicated queries, see which queries are taking too long, the memory tab allows you to find memory leaks, and it also looks beautiful!
Developed using Yii Framework 1.1.8 but it may work with other versions.
'log'=>array( 'class'=>'CLogRouter', 'routes'=>array( array( 'class'=>'CFileLogRoute', 'levels'=>'error, warning', ), array( 'class' => 'application.extensions.pqp.PQPLogRoute', 'categories' => 'application.*, exception.*', ), ), ),
Note: if you plan to use phpunit and for some reason you are using a config file that includes PQP you'll get errors about assets folder, to solve this you can set up you log route in the following way as suggested by thefsb
'log'=>array( 'class'=>'CLogRouter', 'routes' => array_merge( array( array( 'class'=>'CFileLogRoute', 'levels'=>'error, warning, info', ), ), array(php_sapi_name() !== 'cli' ? array( 'class' => 'application.extensions.pqp.PQPLogRoute', 'categories' => 'application.*, exception.*, system.*', 'levels'=>'error, warning, info', ) : array('class'=>'CWebLogRoute', 'enabled'=>false) ) ), ),
'db'=>array( 'connectionString' => '...', 'enableProfiling' => true, 'enableParamLogging' => true, ),
/** * Logs a memory message. * @param mixed $obj any type of variable to profile memory * @param string $msg message to be logged * @param string $category category of the message (e.g. 'system.web'). It is case-insensitive. */ public static function logMemory($obj, $msg = '', $category='application'){
PQPLogRoute::logMemory("memory used after action call"); try { Yii::beginProfile('Execution time'); Yii::log('Begin logging data'); PQPLogRoute::logMemory($this, "the site controller"); $arr = array('Name' => 'Ryan', 'Last' => 'Campbell'); Yii::log(CVarDumper::dumpAsString($arr)); PQPLogRoute::logMemory($arr, "Normal array"); $users = User::model()->findAll(); PQPLogRoute::logMemory($users, "Users array"); Yii::endProfile('Execution time'); throw new Exception('Unable to write to log!'); } catch(Exception $e) { Yii::log($e, CLogger::LEVEL_ERROR); } PQPLogRoute::logMemory("memory used before render");





Total 11 comments
Is there any way to keep log history on each refresh?
Suppose we have a submit form and when we submit the form it sends the values a action file and page is suddenly redirected to success page. So your logging system logs of success page but not of the action page. If we want to show the form value in log while processing the action before redirecting the success page then how we can do this?
We can achieve this in file logging because all logged data are appended every time logger is called.
If you implement the history system then your extension will be best among all.
thanks for providing a great extension.
Thanks for providing a very useful extension.
Is there any easy way to enable the extension only on 127.0.0.1(localhost) and disable automatically if it is not on localhost.
IT's great now that i got it to work correctly!
Maybe we could adapt it to be the default profiler and log utility for the whole application.
@oceatoon the screenshots are right above these comments
Please check this post
Please try to keep your questions in the forum.
It really is a nice piece of software but unfortunately i can't seem to get it to work properly, i've even copied it from the svn on google code and it still doesn't show anything...
reading yii log has never been that easy !!! thanks for this great extension ....
This is a nice improvement over the built in profiling and web logger.
And it looks impressive too.
Hi,
Its a Web log route, meaning it will show up in every page, if you are not seeing anything, try to log something, or add system.* to your categories.
thanks for sharing , the class is worth reading , good skills
Hi sounds interesting but what's the url to see the log as in screenshots ?
Leave a comment
Please login to leave your comment.