apprentice (77) [Avatar] Offline
#1
In page 379 Rob wrote:

[pre]
...just log the profile data after the call to "dispatch()" in the Bootstrap.

...
...

There's quite a lot going on there, so it would be wise to factor it into its own function.
The log produced looks something like this:
[/pre]

Since the book was written during the ZF 1.7.1 era and I'm now using Akrabat's ZF 1.8 era. The Bootstrap doesn't look like it did. So I "included" the specific code in the Index.php file instead. Is this a correct thing to do?

And how should I modify these files so that the Db_Profiler code connects correctly within the MVC. I don't get any SQL output in my log file. I just get the usual Syslog 1-liner.


bat2publicindex.php

http://pastebin.com/m311245c7
[pre]
$application->bootstrap()
->run();



//______________//
// Customized //
//______________//

/* Create database metrics */
require_once '../library/Customized/ZFiA_DbMetric.php';
$instance = new ZFiA_DbMetric;
[/pre]




bat2libraryCustomizedFiA_DbMetric.php

http://pastebin.com/m7fb18a32
[pre]
class ZFiA_DbMetric
{
public function __construct()
{
$this->formatMsg1();
}

public function formatMsg1()
{
........
........
}
[/pre]
apprentice (77) [Avatar] Offline
#2
Re: Howto factor Db_Profiler code outside Bootstrap? - page 379
False alarm I found the problem. smilie


bat2libraryCustomizedFiA_DbMetric.php



Bad

$logger->log('$log', Zend_Log:smilieEBUG);



Good

$logger->log($log, Zend_Log:smilieEBUG);