Skip to content


Subversion checkout URL

You can clone with
Download ZIP


The Log module is not ServiceManager friendly #2568

zfbot opened this Issue · 8 comments

5 participants


Jira Information

Original Issue: ZF2-535
Issue Type: Improvement
Reporter: texdc
Created: 09/09/12
Assignee: weierophinney
Components: Zend\Log Zend\ServiceManager


Using a configuration array to wire up a global logger is currently obtuse. Writers construct signatures vary too much to be practical. Here's what I want to do in my autoload/global.php:

    'logger' => array(
        'writers' => array(
            'Stream' => array(
                'streamOrUrl' => 'log/application.log',

Now, I can write a custom Factory just for that Writer. But, as soon as I try to make it generic for any writer, I run into signature hell. I haven't even begun to try to config filters or formatters.



(Originally posted by: texdc on 09/09/12)

Also, regarding the tutorial project: Who starts any project without logging? Only amateurs.


(Originally posted by: b-durand on 09/11/12)

What is your problem exactly? Can you add the actual config to compare with the expected config?

I don't see something different in log4php, if you take two appenders like File and PDO: you need to define dsn for PDO, and file for File.


(Originally posted by: texdc on 09/17/12)

Where is an example of the current recommended service manager config for a global logger with multiple writers? If you can provide a clean example, then this issue can be closed.


This issue was ported from the ZF2 Jira Issue Tracker at

Known GitHub users mentioned in the original message or comment:
@texdc, @weierophinney, @b-durand


As far as I understand your problem is, that you cannot use an array (=config file) to setup the loggers. This was possible in ZF1 but it was marked as todo in ZF2. I've tried to provide that functionality in #2725


@stefankleff Given that #2725 was merged, does that mean this issue can be closed?


I think so. I'm not the creator of this issue, but I covered the mentioned use case in #2725.

@Maks3w Maks3w closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.