Hi,

I hope this is the right list to discuss this.

I have a project using ZF1 (v1.6.2 - due to needing to run it on PHP 5.1) - and have a quick question. For debug purposes I put a couple of logging calls into my Bootstrap.php - one early on and one at the end of the script (let's call them "early" and "late"). When testing my home page in the browser, I noticed that the Bootstrap.php gets called 5 times. At least, there are five sets of log messages.

This might be a "how long's a piece of string" question, but can anyone guide me as to why this might be happening? What triggers the apparent multiple execution of Bootstrap.php?

(For info - In this version of ZF, there is no Bootstrap class declaration within Bootstrap.php. I guess that came later...)

The strange part of this is, that, depending on which controller I execute (through the browser), the pattern of early-late log messages varies. This is demonstrated in the log output below. If I browse the home page (/index/index), the early log message appears once, followed by the late log message. Then the early message will appear three times, followed by the late one three times, and then the early one once, then the late one once. E.g.

2012-05-25T10:48:22+01:00 INFO (6): Setting up logging...
2012-05-25T10:48:23+01:00 INFO (6): [Bootstrap] Logging level set to WARN
2012-05-25T10:48:22+01:00 INFO (6): Setting up logging...
2012-05-25T10:48:22+01:00 INFO (6): Setting up logging...
2012-05-25T10:48:22+01:00 INFO (6): Setting up logging...
2012-05-25T10:48:23+01:00 INFO (6): [Bootstrap] Logging level set to WARN
2012-05-25T10:48:23+01:00 INFO (6): [Bootstrap] Logging level set to WARN
2012-05-25T10:48:23+01:00 INFO (6): [Bootstrap] Logging level set to WARN
2012-05-25T10:48:22+01:00 INFO (6): Setting up logging...
2012-05-25T10:48:23+01:00 INFO (6): [Bootstrap] Logging level set to WARN

Based on this output, I refer to this as a "1-3-1".

But if I browse another part of my site, say /article/view, then the bootstrap execution pattern will change to a 1-2-1 (there will be 1 set of early-late messages, followed by 2 early messages, followed by 2 late messages, followed finally by 1 of each again, in that order). My app is fairly MVC-based, and each controller sets up access to one or more models for db access. Could each new model cause this repeated bootstrapping?

Sorry for the long message. I'm trying to get my head around why this is happening and what I can do to streamline my code - it's running pretty slowly at the moment for the simple tasks required.

Many thanks for any help, in anticipation...

Kind regards,
Steve

--
Steve Dowe
Web Developer / RHCE


--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to