views:

62

answers:

1

I have a fresh install of Zend Framework v1.10.5 on my application server. The only modifications are the two init methods below in which I simply set up a logger and write to it as a part of the bootstrap process.

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected $_log;

    protected function _initLogging()
    {
        $log = new Zend_Log();
        $writer = new Zend_Log_Writer_Stream(
            APPLICATION_PATH . '/../data/logs/app.log');
        $log->addWriter($writer);
        $this->_log = $log;
        $this->_log->info('Logging initialized.');
    }

    protected function _initHello()
    {
        $this->_log->debug('Hello!');
    }
}

When I make a request (initializing the application), the following lines appear in my app.log...

2010-06-04T05:24:41+00:00 INFO (6): Logging initialized.
2010-06-04T05:24:41+00:00 DEBUG (7): Hello!
2010-06-04T05:24:41+00:00 INFO (6): Logging initialized.
2010-06-04T05:24:41+00:00 DEBUG (7): Hello!

Can someone please explain why Zend appears to be bootstrapping the application twice? Again, this is a completely fresh (out-of-the-box) instance of Zend Framework.

+3  A: 

It's probably either:

  1. On each request, your browser is also making a request to http://yourdomain.com/favicon.ico, which doesn't exist. This request will therefore also go through ZF, which will go through the same bootstrap process. To avoid this you can either create a favicon file or modify your .htaccess file so that the request doesn't go through ZF.

  2. You have an application.ini file which is also bootstrapping the logger. If this is the case please can you edit your post to include your application.ini file (with passwords etc. removed).

Tim Fountain
@Tim - You're right on the money, as embarrassing as that is for me. I never thought to check the access logs as this was/is a fresh /untouched ZF installation in our dev env. Luckily our normal logging process will catch this in the future. Thanks agin for your response!
jeyroz