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