[Extension] FirePHP LogRoute

Hi! This is just a small extension I made a few days ago. I hope it’s useful.


FirePHP LogRoute

This extension sends Yii log messages to FirePHP. It inherits from CLogRoute and uses the same method and configuration as the other built-in logging components: CFileLogRoute, CWebLogRoute, etc.

Tested on Yii 1.1.0.

Extension page: http://www.yiiframework.com/extension/firephp-logroute/

GitHub page: http://github.com/shiki/yii-firephplogroute

Have you seen this one? http://www.yiiframework.com/doc/api/CWebLogRoute#showInFireBug-detail

Yes I did. From what I can tell, it prints out console.log messages at the end of the page. These messages can then be viewed in Firebug’s console. But it’s not capable of logging arrays like:

Yii::log(array('array-to-check' => array('value1', 'value2')), CLogger::LEVEL_INFO);

The above will just show an “Array” text message when using CWebLogRoute. When using FirePHP, you’ll get the actual array contents.

Also, FirePHP allows logging even through an AJAX call without disturbing the output (i.e. json), which was what I really needed.

This looks great, and the install instructions seem clear, but I’m not getting any output. I’ve installed FirePHP, installed the core class in a protected/vendors directory, installed shiki in protected/extensions, set the output_buffering to 4096 and set up my config.

Any idea on what I might have missed? No errors in httpd log, application.log or Firebug console.

Thanks in advance.

Here’s the config lines from the routes array:


	'class'  => 'application.extensions.shiki.firePHPLogRoute.ShikiFirePHPLogRoute',

	'fbPath' => 'application.vendors.FirePHPCore.fb',

	'levels' => 'error, warning, trace, info',


Hi! I can’t think of a good reason it won’t work but…

Does using WebLogRoute work?


  'class' => 'WebLogRoute',

  'levels' => 'trace, info, error, warning',  


If it doesn’t, YII_DEBUG might be disabled:

defined('YII_DEBUG') or define('YII_DEBUG',true);

I think that’s enabled by default though. It could also be (sometimes) a problem with Firebug/FirePHP. Sometimes the logs won’t show up in console (even javascript logs). A restart usually fixes it.

Another long shot: did you restart PHP/Apache after setting up the output_buffering?

Sorry for the stupid questions, that’s all I could think of right now.

Oh…duh! I can’t believe I forgot I had turned that off to send a copy to production! I had commented out the YII_DEBUG line in index.php.


I’ve got this extension installed but it isn’t displaying arrays for me - it simply shows my the standard Yii log message eg.

application: Array in C:\xampp\htdocs\protected\controllers\SiteController.php (32) in C:\xampp\htdocs\index.php (13)

Everything else seems to be working. Any thoughts? I’m using Yii 1.1.3 and calling the log command as follows:

Yii::log($_SERVER, CLogger::LEVEL_INFO);

Is that log from Firebug/FirePHP?

Hi, Yes it’s a direct copy/paste from the firebug window. For me FirePHP is just showing exactly the same as the Yii CWebLogRoute. Nothing extra for arrays etc.

That’s odd. It works fine on my side. It actually shows something like this:

application: array('REDIRECT_STATUS'=>'200', 'HTTP_HOST'=>'l.piclyf.com', 'HTTP_USER_AGENT'=> ... )

Are you using the latest version here? http://github.com/shiki/yii-firephplogroute


I’ve just installed Yii 1.1.5 and tried to add the FirePHPLogRoute extension (shiki-yii-firephplogroute-0.1.2), but failed.

I’ve followed the instructions, but I got this error message:


include(FirePHP.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

Source File


00383:      * @return boolean whether the class has been loaded successfully

00384:      */

00385:     public static function autoload($className)

00386:     {

00387:         // use include so that the error PHP file may appear

00388:         if(isset(self::$_coreClasses[$className]))

00389:             include(YII_PATH.self::$_coreClasses[$className]);

00390:         else if(isset(self::$classMap[$className]))

00391:             include(self::$classMap[$className]);

00392:         else

00393:         {

00394:             if(strpos($className,'\\')===false)

00395: include($className.'.php');

00396:             else  // class name with namespace in PHP 5.3

00397:             {

00398:                 $namespace=str_replace('\\','.',ltrim($className,'\\'));

00399:                 if(($path=self::getPathOfAlias($namespace))!==false)

00400:                     include($path.'.php');

00401:                 else

00402:                     return false;

00403:             }

00404:             return class_exists($className,false) || interface_exists($className,false);

00405:         }

00406:         return true;

00407:     }

Is there anybody who use this extension with yii1.1.5, firebug 1.6.0, firephp 0.5.0, PHP 5.3.3 without troubles?

Any idea on what I might have missed? Thanks.

Hi Gyorgy,

Sorry, the plugin wasn’t working with the latest version of FirePHPCore (0.3.2). I updated it just now. Please download the latest from Github https://github.com/shiki/yii-firephplogroute

Thanks for reporting the problem!

Hi Shiki,

thanks for the quick response.

I’ve installed shiki-yii-firephplogroute-0.1.3-0-gd494f63.zip and this revision is working, but only if I change the libpath from

'libPath' => dirname(__FILE__) . '/path/to/firephp/lib'


'libPath' => '/full/path/to/firephp/lib'



I still get this error:

include(FirePHP.php): failed to open stream: No such file or directory

I tried both of the tutorials here to no avail:


Any ideas?

Hi! Can you please try the updated instructions on Github? This one > https://github.com/shiki/yii-firephplogroute/blob/master/README.md

Sorry, the blog post is currently outdated. Oh, and please make sure you’re using FirePHPCore 0.3.2 and not the 1.0 Beta. Haven’t tested the plugin with the 1.0 version yet.

Hi, nice extension! Very usefull! I found something that maybe can be issue.

In the function processLogs of the extension, in the loop for processing logs you set $method = ‘info’ (line 131) in the start of the loop, and then you run a switch to set the correct level, but the switch dont have the LEVEL_TRACE option and so the next ‘if’ (line 144) never will be true.

— EDIT —

Besides the fact that the trace option is implemented but never used, i found that the trace option is not really usefull in this case, cause the trace stack comes completely from the extension, firebug, and yii log router component.

Hi Alex, this issue bothered me too, what i saw is that when YII_DEBUG is set true and YII_TRACE_LEVEL is greater than zero, the YiiBase class pre-process the log message to put the stack in the message and this way the variable contents is lost. You can see this in YiiBase.php line 431 (version 1.1.6).

In development enviroment my default setting is YII_DEBUG = true and YII_TRACE_LEVEL = 0, this way i still can see the variables and yii debug logs in firephp, and if i need to see the stack trace i rise the YII_TRACE_LEVEL constant.

Hope it helps.

@Eduardo thanks for sharing that!

Thank you very much, Eduardo.

Hi guys,

I have updated this extension. I added a new profile log route, SFirePHPProfileLogRoute. This works exactly like CProfileLogRoute except that the output is routed to FirePHP. The FirePHPCore library code is also now included in the package so you don’t have to include it anymore. It’s no longer required to set the path of the library. Hopefully this will be more convenient for everyone. The old class ShikiFirePHPLogRoute was also renamed to SFirePHPLogRoute.

Please see the extension page or the GitHub page for more.