Difference between #1 and #4 of
SQL Logging and Profiling in FireBug (Yii 1.1)

Changes

Title unchanged

SQL Logging and Profiling in FireBug (Yii 1.1)

Category unchanged

Tutorials

Yii version unchanged

Tags changed

Logging

Content changed

[...]
Personally, I prefer to build this into my "index.php" file - here's an example of how to modify the configuration depending on the domain name, to have the SQL logging and profiling turned on when you're testing your site from a local domain.

Example "index.php" file:

    <?php
 
 
    
 
```php 
// change the following paths if necessary     $yii=dirname(dirname(__FILE__)).'/framework/yii.php';     $config=dirname(__FILE__).'/protected/config/main.php';     // remove the following line when in production mode     if ($_SERVER['HTTP_HOST'] == 'localhost') {   defined('YII_DEBUG') or define('YII_DEBUG',true);    $config['components']['log']['routes'][] = array(  'class'=>'CWebLogRoute',   'categories'=>'system.db.CDbCommand',   'showInFireBug'=>true,    );   $config['components']['db']['enableProfiling'] = true;    $config['components']['db']['enableParamLogging'] = true;     }     require_once($yii);     Yii::createWebApplication($config)->run();  
```
It's as simple as that - now run the site with FireBug enabled, and you should see your SQL queries, with parameters, displayed on the Console tab in FireBug!
 
 
### Links
 
 
[Russian version](http://dbhelp.ru/firebug-and-sql-routing/page/)
6 0
6 followers
Viewed: 37 540 times
Version: 1.1
Category: Tutorials
Tags: Logging
Written by: mindplay
Last updated by: qiang
Created on: Dec 24, 2009
Last updated: 14 years ago
Update Article

Revisions

View all history