Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Added abstract service factory for logger component to provide several loggers for application. #3930

Merged
merged 5 commits into from
Mar 11, 2013
Merged

Conversation

andrei-stsiapanau
Copy link
Contributor

Added support for multiple loggers in application.
Configuration should be like this:

'logger' => array(
    'Backend\Logger' => array(
        'writers' => array(
            array(
                'name' => 'stream',
                'priority' => 1,
                'options' => array(
                    'stream' => __DIR__ . '/data/log/backend.log',
                ),
                'filters' => array(
                    array(
                        'name' => 'priority',
                        'options' => array(
                            'priority' => E_STRICT | E_WARNING | E_NOTICE
                        ),
                    ),
                ),
                'formatter' => array(
                    'name' => 'base',
                    'options' => 'Y-m-d H:i:s',
                ),
            ),
        ),
    ),
    'Frontend\Logger' => array(
        'writers' => array(
            array(
                'name' => 'stream',
                'priority' => 1,
                'options' => array(
                    'stream' => __DIR__ . '/data/log/frontend.log',
                ),
            ),
        ),
    ),
)

weierophinney and others added 2 commits March 1, 2013 09:35
configuration.

Change-Id: Ibd9309bf42c8992376849a1c5bbae05cd82e4c13
return true;

} else {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete the "else", finish with "return false" without else

method.

Change-Id: Idf4802f8735a2333d927f5c6989e124c048e7854
@andrei-stsiapanau
Copy link
Contributor Author

@blanchonvincent done.

@blanchonvincent
Copy link
Contributor

@Stephanoff ok, now you must add unit tests with the PR

Change-Id: Ibd0e492df076b801cb91078753bfe40bf77f63c0
@andrei-stsiapanau
Copy link
Contributor Author

@blanchonvincent Test case added.

@ghost ghost assigned weierophinney Mar 8, 2013
Change-Id: I8e342727e72db510a45b885ddb293ceef4590510
@weierophinney
Copy link
Member

@Stephanoff This is brilliant. I'd like to see this approach adopted in more places, to be honest!

weierophinney added a commit that referenced this pull request Mar 11, 2013
Added abstract service factory for logger component to provide several loggers for application.
weierophinney added a commit that referenced this pull request Mar 11, 2013
@weierophinney weierophinney merged commit 49afaf4 into zendframework:develop Mar 11, 2013
@andrei-stsiapanau andrei-stsiapanau deleted the develop-logger branch March 12, 2013 06:04
* @subpackage UnitTests
* @group Zend_Log
*/
class LoggerAbstractServiceFactoryTeset extends \PHPUnit_Framework_TestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Teset?

@steptom
Copy link

steptom commented May 25, 2013

I have recently migrate to the 2.2.0 version of Zend Framework and I can't add a filters and formatter to the writer by using the configuration you give as example.
Is it normal ?

(It would be unfortunate to be able to create loggers without being able to specify filters and formatter)

@andrei-stsiapanau
Copy link
Contributor Author

Hi @steptom,

Try to use 'log' section name instead of 'logger'.
It changes due to compatibility with LoggerServiceFactory.

@steptom
Copy link

steptom commented May 26, 2013

Hi @Stephanoff ,
thanks for your answer, this allowed me to partially solve my problem.

In fact, the example has a lot of errors ;)
(For example the formatter and filters parameters are writer options)

weierophinney added a commit to zendframework/zend-log that referenced this pull request May 15, 2015
…evelop-logger

Added abstract service factory for logger component to provide several loggers for application.
weierophinney added a commit to zendframework/zend-log that referenced this pull request May 15, 2015
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants