Op Monday 08 June 2009 00:13:41 schreef Ehask71:
> In the past I usually did this:
>
>   public static function setupDatabase()
>     {
>         $config = self::$registry->configuration;
>         $db = Zend_Db::factory($config->db->adapter,
> $config->db->toArray());
>         $db->query("SET NAMES 'utf8'");
>         self::$registry->database = $db;
>         Zend_Db_Table::setDefaultAdapter($db);
>         // Logger
>         $columnMapping = array('lvl' => 'priority', 'msg' => 'message');
>         $writer = new Zend_Log_Writer_Db($db, 'log', $columnMapping);
>         $logger = new Zend_Log($writer);
>         self::$registry->logger = $logger;
>     }
>
> I setup my Webhosting server to allow Zend_Tool and such. Now I have the
> Zend_application Bootstrap class.   So how do I add an application wide
> logger like above
>
> Thx for any help
>
> Eric

You could create a Db resource which will initiate your database and set the 
adapter to the default one. You also create a log resource, which first 
bootstraps the db resource. Then you're sure the db is setup correctly. The 
$db var is the same as Zend_Db_Table::getDefaultAdapter() :)

Regards, Jurian
--
Jurian Sluiman
Soflomo.com

Reply via email to