-
Notifications
You must be signed in to change notification settings - Fork 800
Passing an exception as the message to Zend_Log_Writer_Db raises an exception #23
Comments
(Originally posted by: Andrew Ballard on 10/04/12) Fixed code block. |
(Originally posted by: froschdesign on 02/15/13) Hi Andrew, {quote} tried to resolve this by extending Zend_Log_Writer_Db to override the _write method, but all of the properties are marked private instead of protected for some reason.{quote} Thanks for your help! :) |
(Originally posted by: Andrew Ballard on 02/15/13) {quote} This problem was fixed with ZF-12514.{quote} Thank you! I was ultimately able to extend {{Zend_Log_Writer_Db}} in a way that works with the current version. I'm still not sure if this is the best way of handling things, but this is the class I came up with:
Hopefully this is useful to someone else. |
This issue was ported from the ZF2 Jira Issue Tracker at Known GitHub users mentioned in the original message or comment: |
I've recently had to extend the DB writer If the intention was to encourage downstream DB writer classes to be a direct offshoot of the abstract class with entire methods copied from |
I think, it was fixed with 2882bc7 and released with 1.12.5. If I've missed something, please feel free to reopen this issue. |
Jira Information
Description
The other log writers allow you to pass an instance of an exception as the message for logging. In particular, Zend_Log_Writer_Firebug even has a formatter that renders in a way that is easy to read when debugging XmlHttpRequests. However, I get an exception in Zend_Log_Writer_Db because the message is an object:
I can pass the exception in as a string, but then it is more difficult to read in Firebug. I'm also not sure if this problem is specific to the database adapter I am using (Zend_Db_Adapter_Sqlsrv) since I don't have another database/adapter I can test right now.
I think a change in Zend_Log_Writer_Db::_write() should fix it but I don't know if it might raise other issues:
I tried to resolve this by extending Zend_Log_Writer_Db to override the _write method, but all of the properties are marked private instead of protected for some reason. As a result, getting it to work would have required duplicating the entire class. (If they truly need to be private, perhaps the class should be final?)
The text was updated successfully, but these errors were encountered: