@@ -88,6 +88,57 @@ that service is preconfigured to use the channel you've specified.
88
88
For more information - including a full example - read ":ref: `dic_tags-monolog `"
89
89
in the Dependency Injection Tags reference section.
90
90
91
+ .. _cookbook-monolog-channels-config :
92
+
93
+ Configure Additional Channels without Tagged Services
94
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95
+
96
+ .. versionadded :: 2.3
97
+ Since Symfony 2.3 you can install MonologBundle 2.4 to be able to configure
98
+ additional channels in the configuration.
99
+
100
+ With MonologBundle 2.4 you can configure additional channels without the
101
+ need to tag your services:
102
+
103
+ .. configuration-block ::
104
+
105
+ .. code-block :: yaml
106
+
107
+ # app/config/config.yml
108
+ monolog :
109
+ channels : ["foo", "bar"]
110
+
111
+ .. code-block :: xml
112
+
113
+ <!-- app/config/config.xml -->
114
+ <container xmlns =" http://symfony.com/schema/dic/services"
115
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
116
+ xmlns : monolog =" http://symfony.com/schema/dic/monolog"
117
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
118
+ http://symfony.com/schema/dic/services/services-1.0.xsd
119
+ http://symfony.com/schema/dic/monolog
120
+ http://symfony.com/schema/dic/monolog/monolog-1.0.xsd"
121
+ >
122
+ <monolog : config >
123
+ <monolog : channel >foo</monolog : channel >
124
+ <monolog : channel >bar</monolog : channel >
125
+ </monolog : config >
126
+ </container >
127
+
128
+ .. code-block :: php
129
+
130
+ // app/config/config.php
131
+ $container->loadFromExtension('monolog', array(
132
+ 'channels' => array(
133
+ 'foo',
134
+ 'bar',
135
+ ),
136
+ ));
137
+
138
+ With this, you can now send log messages to the ``foo `` channel by using
139
+ the automically registered logger service ``monolog.logger.foo ``.
140
+
141
+
91
142
Learn more from the Cookbook
92
143
----------------------------
93
144
0 commit comments