The Zend Logger integration was done months ago, and we had not all the tools we have today. So, I work on it today and adding writers should be easy now:

https://github.com/fabpot/symfony/commit/aea712d8a20ed6a0cb46b49726b0a2cf5b150bf9

Anywhere in one of your configuration file, add a service for your writer and tag it with "zend.logger.writer".

Here is a writer skeleton:

<service id="zend.logger.writer.xxx" class="xxx">
    <tag name="zend.logger.writer" />

    <!-- ... -->
</service>

Fabien

--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.org | fabien.potencier.org
Tél: +33 1 40 99 80 80

On 1/4/11 12:08 PM, Sven Paulus wrote:
Hi,

I'm new to Symfony2 and the Dependency Injection Container system and
I'm looking for a way to replace the file based logging by a syslog
based logging. I'm not sure how to do this "the right way" in Symfony2.

This was quite simple in symfony 1.x: Write a small class that extends
sfLogger and implements all necessary steps to syslog the log messages.
This class could be added to the application's factories.yml (including
all parameters required) and everything was fine.

To achieve the same in Symfony2 I'd have to instruct ZendBundle to use
Zend\Log\Writer\Syslog instead of Zend\Log\Writer\Stream.
Since the configuration parameters of these two classes are incompatible
to each other just overwriting the "zend.logger.writer.filesystem"
parameter of ZendBundle's logger.xml with "Zend\Log\Writer\Stream" is
not sufficient.

The logger.xml is only loaded from the fixed ZendBundle/Resources
location, so it is not possible to use an application specific
logger.xml configuration which adds a new "addWriter" line for syslog
based logging to the "zend.logger" service definition.

What is the right Symfony2 way to extend the ZendBundle other than
patching the bundle itself? Creating a new new bundle "MyZendExtension",
inherit from the ZendExtension.php class and extend the
MyZendExtension.php class with the additional parameter handling needed
for syslogging? But how can I make the "addWriter" lines of the
"zend.logger" service configurable in the application so that I can
switch between file based and syslog based logging without changing the
code?

For the moment the old-fashioned symfony 1.x way seems to be more
flexible and easier to implement, but surely I'm missing something - I'd
be happy about a hint how to approach this :-)

Regards,

Sven

--
If you want to report a vulnerability issue on symfony, please send it
to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to