Search code examples
zend-frameworkzend-log

Zend_Log replace existing writer by a new one


here is my problem: I would like to use and existing Zend_Log instance (instance which already exists in my application) but I would like to write my logs to a different file (same path to log file like in the existing writer but with different name). Do you guys have any idea how can I do this ? so far I only found a solution which is based on a Zend_Log instance + few writers + filter -> each log entry is written to a different file name. Existing Zend_Log instance has a one single writer (instance of Zend_Log_Writer_Stream class). Im under impression that such thing is really trivial but Im not able to find it. My current solution is to create a new instance of Zend_Log and add a new writer. Any suggestions are welcome :) I hope this is not a silly question :D Im not a ZF master.


Solution

  • In the current implementation you cannot detach a writer from a Zend_Log.

    Your options are:

    • add new writer to Zend_Log and submit yourself to the fact that there will be two logs.
    • create new Zend_Log with only one writer attached.