ZF2-531: Zend log to Db writer and MySQL

Issue Type: Bug Created: 2012-09-07T14:57:38.000+0000 Last Updated: 2012-09-09T13:26:29.000+0000 Status: Resolved Fix version(s): - 2.0.0 (06/Sep/12)

Reporter: Fred (topgear) Assignee: Fred (topgear) Tags: - Zend\Log

  • zend-log

Related issues: Attachments:


The error message I get: Object of class DateTime could not be converted to string in /Zend/Db/Adapter/Driver/Pdo/Statement.php on line 256

The MySQL table I have: CREATE TABLE logs ( date datetime DEFAULT NULL, type tinyint default NULL, event varchar(255) default NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

The code:

'Pdo', 'dsn' => 'mysql:dbname=logs;hostname=localhost', 'username' => 'root', 'password' => 'password', 'driver\_options' => array( PDO::MYSQL\_ATTR\_INIT\_COMMAND => 'SET NAMES \\'UTF8\\'' ), ); $mapping = array( 'timestamp' => 'date', 'priority' => 'type', 'message' => 'event' ); $db = new DbAdapter($dbConfig); $dbWriter = new Log\\Writer\\Db($db, 'logs', $mapping); $logPriority = $logDebug ? Log\\Logger::DEBUG : Log\\Logger::INFO; $dbWriter->addFilter(new Log\\Filter\\Priority($logPriority)); $logger->addWriter($dbWriter); // do the logging $logger->crit('Crit message goes here!'); ### Comments Posted by Fred (topgear) on 2012-09-09T13:20:35.000+0000 Apologies guys. Still had ZF2 beta2 on this desktop. Updated to 2.0.0 and don’t have this problem any more. ZF2 is just great! Posted by Fred (topgear) on 2012-09-09T13:26:29.000+0000 Was not a bug. I was using the wrong Zend Framework version (beta2) on this desktop.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.