Zendcasts Forum

A community of developers who work with the Zend Framework and other enterprise PHP technologies

You are not logged in.

#1 2010-04-13 16:41:35

shaded2
New member
Registered: 2010-02-16
Posts: 9

zend_log

Any one know how to set up zend log.  This is what i have in the bootstrap

 protected function _initLogging()
    {
        $this->bootstrap('frontController');
        $logger = new Zend_Log();

        $writer = 'production' == $this->getEnvironment() ?
            new Zend_Log_Writer_Stream(APPLICATION_PATH . '/data/logs/app.log') :
            new Zend_Log_Writer_Firebug();
        $logger->addWriter($writer);

        /*if ('production' == $this->getEnvironment()) {
            $filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT);
            $logger->addFilter($filter);
        }*/

        $this->_logger = $logger;
        Zend_Registry::set('log', $logger);
        
        
    }

However im not really sure how to call it in my other files.

$this->_logger->info('Bootstrap ' . __METHOD__);

works if im calling in other bootstrap functions but not sure how to call outside of bootstrap.

Offline

#2 2010-04-14 17:35:54

iznogood
Member
From: Montreal
Registered: 2009-12-17
Posts: 20
Website

Re: zend_log

Zend_Registry::get('log')->info('whatever text');

Since you set it to the Zend_Registry just retrieve it from there. Thats how I use translations.
Hope this helps!

Offline

#3 2010-04-14 19:49:17

shaded2
New member
Registered: 2010-02-16
Posts: 9

Re: zend_log

Thanks.   that worked!

Offline

Board footer

Powered by FluxBB