1

I am currently playing with zf2 and firephp. I've got it running correctly, but I am not really happy with what information it is displaying. If I don't have any errors / warning when loading a page, I am only logging my sql queries.

Before on zf1, I had something really simple: a table with 3 columns:

time | Event (the sql query) | Paramters

0.00013 | SELECT * FROM tb_user | NULL

Now, it displays also 3 columns but they are:

File | Line | Instruction

And my point is I am not really happy with that as it displays a whole bunch of log that I don't want, such as:

FirePHP->trace( 'array (\n)')

Zend\Log\Writer\FirePhp\FirePhpBridge->trace( 'array (\n)')

...

which seems to be what has been executed internally when the page loads. This is basically what I am trying to delete from the logs so I can only keep my sql query.

In addition, when setting my writer to be firePhp, it massively slows down my page. Just executing a query that returns 10 results go for like a seconde to something like 10secs!!

If that helps, here is how I call it:

Module.php

public function onBootstrap(MvcEvent $e)
{
   ...
   $eventManager->attach('dispatch', array($this, 'onDispatch'), 100);
}
public function onDispatch(MvcEvent $e)
{
    $objWriter = new Log\Writer\FirePhp( new Log\Writer\FirePhp\FirePhpBridge(\FirePHP::getInstance(true) ) );
    
    $objLogger = new Log\Logger();
    $objLogger->addWriter($objWriter);

    \My_Logger::setLogger( $objLogger);
}

MyList.php

My_Logger::debug( $this->_strSql);
My_Logger::debug( $this->_arrBind);

And My_Logger class just at the moment extends Zend_Log

My_Logger.php

abstract class My_Logger extends Zend_Log
{
   ...
   static public function debug( $mxdMessage)
   {
       self::$_objLogger->debug( $mxdMessage);
   }

Any kind of help would be really appreciated :) as I found quite a few tutorials on how to set up firePhp, but not on how to configure it !

Community
  • 1
  • 1
mokk
  • 916
  • 17
  • 35
  • Did u try to use [Zend Developer Tools](https://github.com/zendframework/ZendDeveloperTools) for such tasks like logging sql queries for debugging purposes? – edigu Oct 30 '13 at 22:04
  • No I haven't as I found firePhp with zf1 very useful, I would like to keep it for zf2. Also, I logged my sql query in this example, but I also use firePhp to log any informations: warnings, errors, .... – mokk Oct 30 '13 at 23:05

0 Answers0