Yii Framework Forum: [Extension] FirePHP LogRoute - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Extension] FirePHP LogRoute Rate Topic: -----

#1 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

  Posted 07 March 2010 - 08:25 AM

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.yiiframew...rephp-logroute/
GitHub page: http://github.com/sh...firephplogroute
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,780
  • Joined: 17-January 09
  • Location:Russia

Posted 07 March 2010 - 12:36 PM

Have you seen this one? http://www.yiiframew...nFireBug-detail
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 07 March 2010 - 08:02 PM

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.
1

#4 User is offline   queej 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 04-February 10

Posted 12 April 2010 - 10:00 AM

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:

array(
	'class'  => 'application.extensions.shiki.firePHPLogRoute.ShikiFirePHPLogRoute',
	'fbPath' => 'application.vendors.FirePHPCore.fb',
	'levels' => 'error, warning, trace, info',
	),

This post has been edited by queej: 12 April 2010 - 10:02 AM

0

#5 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 12 April 2010 - 10:39 AM

Hi! I can't think of a good reason it won't work but..

Does using WebLogRoute work?
array(
  '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.

This post has been edited by Shiki: 12 April 2010 - 10:41 AM

0

#6 User is offline   queej 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 04-February 10

Posted 12 April 2010 - 10:43 AM

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.

Thanks!
0

#7 User is offline   Alex Muir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 96
  • Joined: 25-April 09

Posted 26 August 2010 - 10:39 AM

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);

My sites: The Big Eat and The Big Space
0

#8 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 27 August 2010 - 11:55 PM

View PostAlex Muir, on 26 August 2010 - 10:39 AM, said:

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?
0

#9 User is offline   Alex Muir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 96
  • Joined: 25-April 09

Posted 02 September 2010 - 04:18 AM

View PostShiki, on 27 August 2010 - 11:55 PM, said:

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.
My sites: The Big Eat and The Big Space
0

#10 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 07 September 2010 - 10:27 PM

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/sh...firephplogroute
0

#11 User is offline   Gyorgy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-December 10

Posted 16 December 2010 - 12:37 PM

Hi,

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:

Description

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

Source File
/home/gykovacs/YII/yii-1.1.5.r2654/framework/YiiBase.php(395)

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.
0

#12 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 17 December 2010 - 02:14 AM

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/s...firephplogroute

Thanks for reporting the problem!
0

#13 User is offline   Gyorgy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-December 10

Posted 17 December 2010 - 10:08 AM

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'
to
'libPath' => '/full/path/to/firephp/lib'

Thanks,
Gyorgy
0

#14 User is offline   kniphe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 25-December 10

Posted 25 December 2010 - 05:31 AM

View PostShiki, on 17 December 2010 - 02:14 AM, said:

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/s...firephplogroute

Thanks for reporting the problem!


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:
http://www.firephp.o...i/Libraries/Yii

Any ideas?
0

#15 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 25 December 2010 - 10:27 AM

View Postkniphe, on 25 December 2010 - 05:31 AM, said:

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:
http://www.firephp.o...i/Libraries/Yii

Any ideas?


Hi! Can you please try the updated instructions on Github? This one > https://github.com/s...aster/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.
0

#16 User is offline   Eduardo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 26-July 10

Posted 03 February 2011 - 01:29 PM

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.
0

#17 User is offline   Eduardo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 26-July 10

Posted 03 February 2011 - 02:16 PM

View PostAlex Muir, on 26 August 2010 - 10:39 AM, said:

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);



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.
1

#18 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 03 February 2011 - 09:27 PM

@Eduardo thanks for sharing that!
0

#19 User is offline   paul0001 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 21-July 11

Posted 31 August 2011 - 01:44 AM

Thank you very much, Eduardo.
0

#20 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 05 September 2011 - 03:30 AM

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.

Thanks!
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users