FireLogger – a sexy server logger console in Firebug

FireLogger is a Firefox+Firebug addon which provides logging functionality similar to Firebug’s console.log. It sends logging events to a client-side encoded in HTTP headers.
I always really liked an idea of debugging through headers, mostly because you are able to log directly to Firebug and it makes debugging of live sites invisible. I came across this tool by searching for Firephp alternatives, since Firephp never could properly handle redirection logging and I believe latest Companion versions are overcomplicated.
This tool comes from Python world originally, it seems that it was called FirePython at start?! Anyway, I was testing it for a few days and it really works great, it’s stable and easy to use, complements to the author.
You can install it from official or Firefox addon page and it requires Firebug to work:
http://firelogger.binaryage.com/
https://addons.mozilla.org/en-us/firefox/addon/firelogger/
The tool adds another tab in Firebug named Logger in which you can see logs sent from code. If you’re dumping objects or arrays, you just click “more” and variables are shown in right Watchers window. If you click Persist button, logs stays there on redirect/reload, similar as Net functionality in Firebug.
For some reason, current 1.0 version didn’t worked on FF 3.X versions for me, it seems FF 4.X is required. Also, be sure that “Show User-defined properties” is checked on Watchers tab (check screenshot), otherwise you won’t see variables when clicking more in logger window.
Php library is well written, there is only one file you need to include in your projects and you’re good to go. It requires PHP 5.3 or higher and it’s nice example of register_shutdown_function usage.
require 'firelogger.php';
flog("Hello world!");
It can be found at:
github.com
http://firelogger.binaryage.com/#php
Here is simple example I patched up together for testing purposes, to check how it works in Magento, maybe someone is interested: Weiler_FireLogger_example.zip
Mage::helper('firelogger')->log('Hello world!');
$product = Mage::getModel('catalog/product')->load(100);
Mage::helper('firelogger')->debug($product);
Enjoy!
13 comments
I tried it with my development website, But can’t see anything in firelogger. I have PHP 5.3.13 and magento 1.5.1. I tried few random tweaks but none works. Please tell me if there is anything specific I need to do.
Also checked that firelogger and system logger are enabled from admin.
There is no error although.
Test website url is bombaybeautystore.com/dev in case you want to have a look.
Thanks
Should the FireLogger work in the admin area? I am trying to using to debug the pdf invoice.
You are right, I totally missed it while reading.
FireLogger updated to v.1.1, working great with FF6 !! Download from their page.
@Mondane: I was using FirePhp for some time, it’s mentioned in the article
Take a look at FirePHP (http://www.firephp.org/), essentialy provides the same functionality.
extensions.checkCompatibility.5.0 = false
I’m a bit disappointed there is no FF 5 update !!
Waiting for something similar for Chromium (Google Chrome)
Visiting other posts but got this link, seems interesting, let’s try to use this firefox addon. thank you!
@Toni (our SEO guy): Thanks for changing post image. This is now definitely hottest Inchoo article 🙂
Hi,
1. I propose to update the log function of the helper to:
http://www.pastie.org/2065249
2. It seems that it works only for the first page load. The second time the headers are cached ? Or something like this.
How to made Magento do not cache the headers?
Yes, it works fine for me. If you’re missing object/array dumps under Watchers tab (second screenshot) when clicking more, be sure that “Show User-defined properties” is checked on Watchers tab.
I believe multiple ob_start()-s will work fine, not sure why they wouldn’t ?! I would do the same if I need some global lib that manipulates headers, I would force ob, and if it’s called few times, everything should be flushed at script end (I’m thinking out loud here 🙂 ).
They are checking headers_sent() on shutdown, if the content is sent that should take care of it. But I also think that trigger_error is a bit too much there.
I’m glad you like it !! I started using it on daily basis.
Did you manage to get it working?
For me it displays just the format string, and not the data..
Also, if you notice, the PHP library uses ob_start() to capture the content so it can send the headers before flushing it… won’t work if your app uses ob_start() by itself, and there’s a hack required to disable this and run the encoding handler manually..
They need to add a condition around last register_shutdown_function()
It’s interesting that they provide FIRELOGGER_NO_OUTPUT_HANDLER but don’t take care of disabling encoding on shutdown, i.e. when the content was already sent.
Unless I missed something?
Otherwise, nifty little add-on.