You cannot instantiate a Database Logger from an Ini configuration yet.
Either setup the Logger in your Bootstrap within an _initLog
method or extend the regular Zend_Log class to use the default DB adapter or better, to instantiate, the DB adapter given in the application.ini.
See here:
And in case you are interested why it doesn't work from application.ini:
The Log Resource Plugin will call the Zend_Log::factory
Method, which in turn will check the Writer you defined and then call this Writer's factory
method to create a new Writer instance. But Zend_Log_Writer_Db
expects the first argument to it's constructor to be a Zend_Db_Adapter
instance, but it will not enforce it.
You cannot supply an instance from the ini file. The writer will check if the _db property is set when you try to write and throw an exception when it's null. But you supplied a string for the property, so _db is not null and it won't throw. Instead, when trying to write your writer will $this->_db->insert()
, causing the error, because _db should be the missing Zend_Db_Adapter
, but is a string, e.g. a non-object.
See the factory() and _write() method for details: