<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[
This proposition covers a new factory method in Zend_Log that eases the creation and configuration of the Zend_Log object. Enable the creation and setup of the Zend_Log object from a Zend_Config object similar the Zend_Db::factory()
A user is able to setup a configuration file with the help of Zend_Config creates the config object and passes the relevant section to the Zend_Log::factory(). The factory method will create the Zend_Log object and adds the configured and enabled log writers. This allows easy configuration and enable/disable logwriters per config section.Zend Framework: Zend_Log Component Proposal
Proposed Component Name
Zend_Log
Developer Notes
http://framework.zend.com/wiki/display/ZFDEV/Zend_Log
Proposers
Martin Roest
Zend Liaison
Matthew Weier O'Phinney
Revision
1.0 - 29 september 2008: Initial Draft. (wiki revision: 14)
Table of Contents
1. Overview
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
4. Dependencies on Other Framework Components
5. Theory of Operation
6. Milestones / Tasks
- Milestone 1: Change the log writers to accept a Zend_Config object or Array when constructing the writer
- Milestone 2: Add the factory method
7. Class Index
- Zend_Log
- Zend_Log_Writer_*
- Zend_Log_Filter_*
- Zend_Log_Exception
8. Use Cases
| UC-01 |
|---|
config.ini (The namespace property is only to indicate support for namespace prefix. It defaults to Zend_Log_Writer):
bootstrap/setup
9. Class Skeletons
Zend_Log
Example of how to implement it with the Zend_Log_Writer_Db
12 Comments
comments.show.hideSep 24, 2008
Thomas Gelf
<p>I like the idea of a shorter way to instantiate loggers and I would welcome a standarized log configuration.</p>
<p>Some thoughts:</p>
<ul>
<li>Stream, Firebug, Syslog and others would easily be configurable this way - but you have to find a solution also fitting Writer_Db and (maybe) Writer_Mail - their constructors currently are asking for objects as their first parameter (Zend_Db_Adapter_Abstract, Zend_Mail)</li>
<li>I don't like the "enabled" switch - if you want to disable a writer you can remove it from config (or set a comment)</li>
<li>Better naming: don't set class names, set writer names (stream, db, syslog...)</li>
<li>Don't forget filters!</li>
</ul>
<p>Best regards,<br />
Thomas Gelf</p>
Oct 03, 2008
Martin Roest
<p>Thanks for your feedback!</p>
<p>I've changed things reflecting your thoughts. Still need some work though. Enabled switch is gone. Classnames are now similar to what Zend_Db does With namespace prefix support to allow inserting your own writers/filters. Added support for filters in the factory.</p>
<p>Wil update in the comming days.</p>
Oct 31, 2008
Matthew Weier O'Phinney
<ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Acceptance</ac:parameter><ac:rich-text-body>
<p>We conditionally approve this for standard incubator.</p>
<p>While we like the idea behind the proposal, we think the implementation could be improved. We would like to see addWriter() and addFilter() modified to allow accepting an array or Zend_Config object – in which cases, it would act as a factory (the factory functionality itself should likely be moved to a protected member). The factory() method itself would then have a much simpler story and fewer concerns.</p></ac:rich-text-body></ac:macro>
Mar 18, 2009
Wil Sinclair
<p>What is the status of this proposal? Other changes are happening to Zend_Log for the 1.8 release, and it would be good to see how this fits in.</p>
Dec 09, 2009
Mark van der Velden
<p>Code has been committed for review.</p>
<ul>
<li><a class="external-link" href="http://framework.zend.com/code/changelog/Zend_Framework?cs=19545">http://framework.zend.com/code/changelog/Zend_Framework?cs=19545</a></li>
<li><a class="external-link" href="http://framework.zend.com/code/changelog/Zend_Framework?cs=19544">http://framework.zend.com/code/changelog/Zend_Framework?cs=19544</a></li>
</ul>
<p>Two points remain:</p>
<ul>
<li>Pending a suggestion how to solve the Zend_Log_Writer_Mail</li>
<li>Documentation needs to be updated.</li>
</ul>
Dec 23, 2009
Sébastien Debrard
<p>filterParams.priority should accept an array IMHO.</p>
<p>in config file, user may want to do:</p>
<p>log.file.filterParams.priority[] = "Zend_Log::CRIT" <br />
log.file.filterParams.priority[] = "My_Package::CRIT" <br />
log.file.filterParams.operator = "=="</p>
<p>See also ZF-8512</p>
Dec 24, 2009
Benjamin Steininger
<p>What about the using a registry-key where the zend_mail instance needs to be ?</p>
Aug 22, 2010
Benoît Durand
<p>See ZF-9990 for Zend_Log_Writer_Mail::factory()</p>
Sep 26, 2010
David Muir
<p>It's missing formatter options</p>
<p>should be able to do:<br />
log.file.formatterName = "Simple"<br />
log.file.formatterParams.format = "%timestamp% %message%"</p>
<p>or<br />
log.file.formatterName = "Xml"<br />
log.file.formatterParams.rootElement = "log"<br />
log.file.formatterParams.elementMap.msg = "message"<br />
log.file.formatterParams.elementMap.level = "priortyName"<br />
log.file.formatterParams.encoding = "UTF-8"</p>
<p>See: <a href="http://framework.zend.com/issues/browse/ZF-9176">#ZF-9176</a></p>
Jan 16, 2011
Benoît Durand
<p>David, this feature is coming soon (see the comments on the issue <a href="http://framework.zend.com/issues/browse/ZF-9176">ZF-9176</a> or <a href="http://framework.zend.com/issues/browse/ZF-9790">ZF-9790</a>).</p>
Jan 30, 2011
Benoît Durand
<p>See <a href="http://framework.zend.com/issues/browse/ZF-10990">ZF-10990</a> to add the support of an option timestampFormat in Zend_Log::factory().</p>
Feb 22, 2011
Aaron S. Hawley
<p>This class butchers the factory pattern since every module in this package has to itself implement a factory method. Fixing this will require changing many of the writers, formatters and filters to except an array or Zend_Config object for the constructor and reaching for the elegance of Zend_Db's success.</p>