Skip to end of metadata
Go to start of metadata

Zend Framework: Zend_Log_Writer_Syslog Component Proposal

Proposed Component Name Zend_Log_Writer_Syslog
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Log_Writer_Syslog
Proposers Thomas Gelf
Zend Liaison Matthew Weier O'Phinney
Revision 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: 20)

Table of Contents

1. Overview

Zend_Log_Writer_Syslog implements a syslog writer for Zend_Log.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

4. Dependencies on Other Framework Components

  • Zend_Log_Writer_Abstract

5. Theory of Operation

This component implements a syslog writer for Zend_Log.

Syslog benefits:

  • There are lots of tools taking care of logfile rotation and such jobs
  • You can scale out your application and easily centralize your logs
  • Fast, small overhead

6. Milestones / Tasks

  • Milestone 1: [DONE] Initial class design
  • Milestone 2: [DONE] Create prototype
  • Milestone 3: [DONE] Finish proposal and submit for community review
  • Milestone 4: Create unit tests

7. Class Index

  • Zend_Log_Writer_Syslog

8. Use Cases

UC-01
UC-02
UC-03
UC-04

9. Class Skeletons

Labels:
proposal proposal Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 24, 2008

    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.

    Otherwise this is greatly appreciated and needed

    1. Sep 24, 2008

      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:

      • openlog(), closelog() and syslog() will never fail
      • feel free to try it out, even killing /dev/log leads to no error

      So I removed all checks for return values, removed exceptions and dependency on Zend_Log_Exception. Not much code left so far

      1. Sep 28, 2008

        thats great. this really looks very promising.

  2. Sep 24, 2008

    Some thoughts regarding multiple instances of this writer:

    • PHP's openlog() function has a "global character"
    • Therefore currently a second syslog writer using a different log facility and / or application name would overwrite the other writer's settings
    • 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
    • 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

    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!

    Cheers,
    Thomas

    1. Sep 26, 2008

      I extended the proposal as suggested (by myself) - multiple instances are now handled automagically (see UC-04).

  3. Oct 15, 2008

    Looks good, isn't it ready for review now?

  4. Oct 31, 2008

    Zend Acceptance
    This proposal is accepted for immediate development in the standard incubator.
  5. Mar 18, 2009

    Has this proposal been abandoned? Please reply here.

    1. Apr 08, 2009

      No, I'm just too lazy for writing tests

      I'll try to do so within April - any idea how to test whether a log line made it to syslog or not?

      Cheers,
      Thomas

  6. Jul 30, 2009

    No news ?

    1. Aug 02, 2009

      Matthew finished docs and cleaned up the code - Zend_Log_Writer_Syslog is part of ZF 1.9.0

      Cheers,
      Thomas