Any user command that extends ContainerAwareCommand has access to the Symfony service container. You can define a service that registers with a custom channel in your configuration.
<services> <service id="console.logger" parent="monolog.logger_prototype"> <argument index="0">mychannel</argument> </service> </services>
You can access your service from a team as follows
$logger = $this->getContainer()->get('console.logger');
This registrar will register with the channel as "mychannel".
FYI The default log service logs for the application channel. This can be seen in the file Symfony/Bundle/MonologBundle/Resources/config/monolog.xml . This is also the place where the default logger service is defined.
<services> <service id="monolog.logger" parent="monolog.logger_prototype" public="false"> <argument index="0">app</argument> </service> <service id="logger" alias="monolog.logger" /> <service id="monolog.logger_prototype" class="%monolog.logger.class%" abstract="true"> <argument /> </service> </services>
Venkat Kotra Jan 23 '13 at 6:26 2013-01-23 06:26
source share