Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba323de

Browse filesBrowse files
committed
Added a code example for emailing on 4xx and 5xx errors without 404's
1 parent 06e7c5f commit ba323de
Copy full SHA for ba323de

File tree

Expand file treeCollapse file tree

1 file changed

+18
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-1
lines changed

‎cookbook/logging/monolog_email.rst

Copy file name to clipboardExpand all lines: cookbook/logging/monolog_email.rst
+18-1Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ it is broken down.
1919
handlers:
2020
mail:
2121
type: fingers_crossed
22+
# 500 errors are logged at the critical level
2223
action_level: critical
24+
# to also log 400 level errors (but not 404's):
25+
# action_level: error
26+
# excluded_404:
27+
# - ^/
2328
handler: buffered
2429
buffered:
2530
type: buffer
@@ -48,6 +53,12 @@ it is broken down.
4853
type="fingers_crossed"
4954
action-level="critical"
5055
handler="buffered"
56+
<!--
57+
To also log 400 level errors (but not 404's):
58+
action-level="error"
59+
And add this child inside this monolog:handler
60+
<monolog:excluded-404>^/</monolog:excluded-404>
61+
-->
5162
/>
5263
<monolog:handler
5364
name="buffered"
@@ -81,6 +92,11 @@ it is broken down.
8192
'mail' => array(
8293
'type' => 'fingers_crossed',
8394
'action_level' => 'critical',
95+
// to also log 400 level errors (but not 404's):
96+
// 'action_level' => 'error',
97+
// 'excluded_404s' => array(
98+
// '^/',
99+
// ),
84100
'handler' => 'buffered',
85101
),
86102
'buffered' => array(
@@ -108,7 +124,8 @@ setting means that the output is then passed onto the ``buffered`` handler.
108124
.. tip::
109125

110126
If you want both 400 level and 500 level errors to trigger an email,
111-
set the ``action_level`` to ``error`` instead of ``critical``.
127+
set the ``action_level`` to ``error`` instead of ``critical``. See the
128+
code above for an example.
112129

113130
The ``buffered`` handler simply keeps all the messages for a request and
114131
then passes them onto the nested handler in one go. If you do not use this

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.