1.0 - 19 September 2008: Posted to mailing list, created proposal after getting some feedback
1.1 - 24 September 2008: Removed Exceptions as PHP doesn't behave as documentation says
1.2 - 27 September 2008: Added "Multi-Instance-Capability" (wiki revision: 21)
<p>Are the error suppressors before syslog and openlog really needed? Because they are expensive PHP-wise. I would like to see a better handling if possible.</p>
<p>Otherwise this is greatly appreciated and needed <ac:emoticon ac:name="smile" /></p>
<p>No - so I removed them. After some discussion on ZF's mailing lists, some tests, ptraces and also greps through PHP's source code I discovered that:</p>
<ul>
<li>openlog(), closelog() and syslog() will never fail</li>
<li>feel free to try it out, even killing /dev/log leads to no error</li>
</ul>
<p>So I removed all checks for return values, removed exceptions and dependency on Zend_Log_Exception. Not much code left so far <ac:emoticon ac:name="wink" /></p>
<p>Some thoughts regarding multiple instances of this writer:</p>
<ul>
<li>PHP's openlog() function has a "global character"</li>
<li>Therefore currently a second syslog writer using a different log facility and / or application name would overwrite the other writer's settings</li>
<li>Calling openlog() is cheap and you can call it as many times as you want. Calling it before each syslog()-call would work, but I wouldn't like to do so, it doesn't seem the correct way of handling this</li>
<li>I could solve this issue using two static and two non-static variables holding current writer settings (app & facility) and the last used ones (in the "global" scope). If one of them has changed, openlog() needs to be called again</li>
</ul>
<p>Probably most users won't even care about this, one syslog facility and app-name is more than enough - but I would like to do things the right way, so any feedback regarding these thoughts is appreciated!</p>
<ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Acceptance</ac:parameter><ac:rich-text-body>
<p>This proposal is accepted for immediate development in the standard incubator.</p></ac:rich-text-body></ac:macro>
11 Comments
comments.show.hideSep 24, 2008
Benjamin Eberlei
<p>Are the error suppressors before syslog and openlog really needed? Because they are expensive PHP-wise. I would like to see a better handling if possible.</p>
<p>Otherwise this is greatly appreciated and needed <ac:emoticon ac:name="smile" /></p>
Sep 24, 2008
Thomas Gelf
<p>No - so I removed them. After some discussion on ZF's mailing lists, some tests, ptraces and also greps through PHP's source code I discovered that:</p>
<ul>
<li>openlog(), closelog() and syslog() will never fail</li>
<li>feel free to try it out, even killing /dev/log leads to no error</li>
</ul>
<p>So I removed all checks for return values, removed exceptions and dependency on Zend_Log_Exception. Not much code left so far <ac:emoticon ac:name="wink" /></p>
Sep 28, 2008
Benjamin Eberlei
<p>thats great. this really looks very promising.</p>
Sep 24, 2008
Thomas Gelf
<p>Some thoughts regarding multiple instances of this writer:</p>
<ul>
<li>PHP's openlog() function has a "global character"</li>
<li>Therefore currently a second syslog writer using a different log facility and / or application name would overwrite the other writer's settings</li>
<li>Calling openlog() is cheap and you can call it as many times as you want. Calling it before each syslog()-call would work, but I wouldn't like to do so, it doesn't seem the correct way of handling this</li>
<li>I could solve this issue using two static and two non-static variables holding current writer settings (app & facility) and the last used ones (in the "global" scope). If one of them has changed, openlog() needs to be called again</li>
</ul>
<p>Probably most users won't even care about this, one syslog facility and app-name is more than enough - but I would like to do things the right way, so any feedback regarding these thoughts is appreciated!</p>
<p>Cheers,<br />
Thomas</p>
Sep 26, 2008
Thomas Gelf
<p>I extended the proposal as suggested (by myself) - multiple instances are now handled automagically (see UC-04).</p>
Oct 15, 2008
Lars Strojny
<p>Looks good, isn't it ready for review now?</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>This proposal is accepted for immediate development in the standard incubator.</p></ac:rich-text-body></ac:macro>
Mar 18, 2009
Wil Sinclair
<p>Has this proposal been abandoned? Please reply here.</p>
Apr 08, 2009
Thomas Gelf
<p>No, I'm just too lazy for writing tests <ac:emoticon ac:name="wink" /></p>
<p>I'll try to do so within April - any idea how to test whether a log line made it to syslog or not?</p>
<p>Cheers,<br />
Thomas</p>
Jul 30, 2009
Alexis Metaireau
<p>No news ? <ac:emoticon ac:name="sad" /></p>
Aug 02, 2009
Thomas Gelf
<p>Matthew finished docs and cleaned up the code - Zend_Log_Writer_Syslog is part of ZF 1.9.0 <ac:emoticon ac:name="smile" /></p>
<p>Cheers,<br />
Thomas</p>