Click Fraud Protection
PHP related blog, freelancer to hire!

Logging page rendering time in Symfony 1.xx

Change your SF_APP/web/index.php file to be:

$timer = sfTimerManager::getTimer('myTimer');
sfContext::getInstance()->getController()->dispatch();
$timer->addTime();
$elapsedTime = $timer->getElapsedTime();
$fullRealUri = str_replace( sfContext::getInstance()->getRequest()->getUriPrefix(), "", sfContext::getInstance()->getRequest()->getUri());
file_put_contents('/tmp/time.log',date('Y-m-d H:i:s')."|$fullRealUri|$elapsedTime\n\r",FILE_APPEND);
Leave a Reply