44How to Configure Monolog to Email Errors
55========================================
66
7- .. caution ::
7+ .. versionadded :: 3.6
88
9- This feature is not compatible yet with the new :doc: `Symfony mailer </mailer >`,
10- so it requires using SwiftMailer .
9+ Support for emailing errors using :doc: `Symfony mailer </mailer >` was added
10+ in MonologBundle 3.6 .
1111
1212`Monolog `_ can be configured to send an email when an error occurs within an
1313application. The configuration for this requires a few nested handlers
@@ -33,9 +33,9 @@ it is broken down.
3333 handler : deduplicated
3434 deduplicated :
3535 type : deduplication
36- handler : swift
37- swift :
38- type : swift_mailer
36+ handler : symfony_mailer
37+ symfony_mailer :
38+ type : symfony_mailer
3939 from_email : ' error@example.com'
4040 to_email : ' error@example.com'
4141 # or list of recipients
@@ -73,11 +73,11 @@ it is broken down.
7373 <monolog : handler
7474 name =" deduplicated"
7575 type =" deduplication"
76- handler =" swift "
76+ handler =" symfony_mailer "
7777 />
7878 <monolog : handler
79- name =" swift "
80- type =" swift_mailer "
79+ name =" symfony_mailer "
80+ type =" symfony_mailer "
8181 from-email =" error@example.com"
8282 subject =" An Error Occurred! %%message%%"
8383 level =" debug"
@@ -114,10 +114,10 @@ it is broken down.
114114 ],
115115 'deduplicated' => [
116116 'type' => 'deduplication',
117- 'handler' => 'swift ',
117+ 'handler' => 'symfony_mailer ',
118118 ],
119- 'swift ' => [
120- 'type' => 'swift_mailer ',
119+ 'symfony_mailer ' => [
120+ 'type' => 'symfony_mailer ',
121121 'from_email' => 'error@example.com',
122122 'to_email' => 'error@example.com',
123123 // or a list of recipients
@@ -162,7 +162,7 @@ You can adjust the time period using the ``time`` option:
162162 type : deduplication
163163 # the time in seconds during which duplicate entries are discarded (default: 60)
164164 time : 10
165- handler : swift
165+ handler : symfony_mailer
166166
167167 .. code-block :: xml
168168
@@ -172,7 +172,7 @@ You can adjust the time period using the ``time`` option:
172172 <monolog : handler name =" deduplicated"
173173 type =" deduplication"
174174 time =" 10"
175- handler =" swift " />
175+ handler =" symfony_mailer " />
176176
177177 .. code-block :: php
178178
@@ -184,12 +184,12 @@ You can adjust the time period using the ``time`` option:
184184 'type' => 'deduplication',
185185 // the time in seconds during which duplicate entries are discarded (default: 60)
186186 'time' => 10,
187- 'handler' => 'swift ',
187+ 'handler' => 'symfony_mailer ',
188188 ],
189189 ],
190190 ]);
191191
192- The messages are then passed to the ``swift `` handler. This is the handler that
192+ The messages are then passed to the ``symfony_mailer `` handler. This is the handler that
193193actually deals with emailing you the error. The settings for this are
194194straightforward, the to and from addresses, the formatter, the content type
195195and the subject.
@@ -217,9 +217,9 @@ get logged on the server as well as the emails being sent:
217217 level : debug
218218 deduplicated :
219219 type : deduplication
220- handler : swift
221- swift :
222- type : swift_mailer
220+ handler : symfony_mailer
221+ symfony_mailer :
222+ type : symfony_mailer
223223 from_email : ' error@example.com'
224224 to_email : ' error@example.com'
225225 subject : ' An Error Occurred! %%message%%'
@@ -259,11 +259,11 @@ get logged on the server as well as the emails being sent:
259259 <monolog : handler
260260 name =" deduplicated"
261261 type =" deduplication"
262- handler =" swift "
262+ handler =" symfony_mailer "
263263 />
264264 <monolog : handler
265- name =" swift "
266- type =" swift_mailer "
265+ name =" symfony_mailer "
266+ type =" symfony_mailer "
267267 from-email =" error@example.com"
268268 subject =" An Error Occurred! %%message%%"
269269 level =" debug"
@@ -303,10 +303,10 @@ get logged on the server as well as the emails being sent:
303303 ],
304304 'deduplicated' => [
305305 'type' => 'deduplication',
306- 'handler' => 'swift ',
306+ 'handler' => 'symfony_mailer ',
307307 ],
308- 'swift ' => [
309- 'type' => 'swift_mailer ',
308+ 'symfony_mailer ' => [
309+ 'type' => 'symfony_mailer ',
310310 'from_email' => 'error@example.com',
311311 'to_email' => 'error@example.com',
312312 // or a list of recipients
0 commit comments