4
4
How to Configure Monolog to Email Errors
5
5
========================================
6
6
7
- .. caution ::
7
+ .. versionadded :: 3.6
8
8
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 in MonologBundle 3.6.
11
10
12
11
`Monolog `_ can be configured to send an email when an error occurs within an
13
12
application. The configuration for this requires a few nested handlers
@@ -33,9 +32,9 @@ it is broken down.
33
32
handler : deduplicated
34
33
deduplicated :
35
34
type : deduplication
36
- handler : swift
37
- swift :
38
- type : swift_mailer
35
+ handler : symfony_mailer
36
+ symfony_mailer :
37
+ type : symfony_mailer
39
38
from_email : ' error@example.com'
40
39
to_email : ' error@example.com'
41
40
# or list of recipients
@@ -73,11 +72,11 @@ it is broken down.
73
72
<monolog : handler
74
73
name =" deduplicated"
75
74
type =" deduplication"
76
- handler =" swift "
75
+ handler =" symfony_mailer "
77
76
/>
78
77
<monolog : handler
79
- name =" swift "
80
- type =" swift_mailer "
78
+ name =" symfony_mailer "
79
+ type =" symfony_mailer "
81
80
from-email =" error@example.com"
82
81
subject =" An Error Occurred! %%message%%"
83
82
level =" debug"
@@ -114,10 +113,10 @@ it is broken down.
114
113
],
115
114
'deduplicated' => [
116
115
'type' => 'deduplication',
117
- 'handler' => 'swift ',
116
+ 'handler' => 'symfony_mailer ',
118
117
],
119
- 'swift ' => [
120
- 'type' => 'swift_mailer ',
118
+ 'symfony_mailer ' => [
119
+ 'type' => 'symfony_mailer ',
121
120
'from_email' => 'error@example.com',
122
121
'to_email' => 'error@example.com',
123
122
// or a list of recipients
@@ -162,7 +161,7 @@ You can adjust the time period using the ``time`` option:
162
161
type : deduplication
163
162
# the time in seconds during which duplicate entries are discarded (default: 60)
164
163
time : 10
165
- handler : swift
164
+ handler : symfony_mailer
166
165
167
166
.. code-block :: xml
168
167
@@ -172,7 +171,7 @@ You can adjust the time period using the ``time`` option:
172
171
<monolog : handler name =" deduplicated"
173
172
type =" deduplication"
174
173
time =" 10"
175
- handler =" swift " />
174
+ handler =" symfony_mailer " />
176
175
177
176
.. code-block :: php
178
177
@@ -184,12 +183,12 @@ You can adjust the time period using the ``time`` option:
184
183
'type' => 'deduplication',
185
184
// the time in seconds during which duplicate entries are discarded (default: 60)
186
185
'time' => 10,
187
- 'handler' => 'swift ',
186
+ 'handler' => 'symfony_mailer ',
188
187
],
189
188
],
190
189
]);
191
190
192
- The messages are then passed to the ``swift `` handler. This is the handler that
191
+ The messages are then passed to the ``symfony_mailer `` handler. This is the handler that
193
192
actually deals with emailing you the error. The settings for this are
194
193
straightforward, the to and from addresses, the formatter, the content type
195
194
and the subject.
@@ -217,9 +216,9 @@ get logged on the server as well as the emails being sent:
217
216
level : debug
218
217
deduplicated :
219
218
type : deduplication
220
- handler : swift
221
- swift :
222
- type : swift_mailer
219
+ handler : symfony_mailer
220
+ symfony_mailer :
221
+ type : symfony_mailer
223
222
from_email : ' error@example.com'
224
223
to_email : ' error@example.com'
225
224
subject : ' An Error Occurred! %%message%%'
@@ -259,11 +258,11 @@ get logged on the server as well as the emails being sent:
259
258
<monolog : handler
260
259
name =" deduplicated"
261
260
type =" deduplication"
262
- handler =" swift "
261
+ handler =" symfony_mailer "
263
262
/>
264
263
<monolog : handler
265
- name =" swift "
266
- type =" swift_mailer "
264
+ name =" symfony_mailer "
265
+ type =" symfony_mailer "
267
266
from-email =" error@example.com"
268
267
subject =" An Error Occurred! %%message%%"
269
268
level =" debug"
@@ -303,10 +302,10 @@ get logged on the server as well as the emails being sent:
303
302
],
304
303
'deduplicated' => [
305
304
'type' => 'deduplication',
306
- 'handler' => 'swift ',
305
+ 'handler' => 'symfony_mailer ',
307
306
],
308
- 'swift ' => [
309
- 'type' => 'swift_mailer ',
307
+ 'symfony_mailer ' => [
308
+ 'type' => 'symfony_mailer ',
310
309
'from_email' => 'error@example.com',
311
310
'to_email' => 'error@example.com',
312
311
// or a list of recipients
0 commit comments