Skip to content

Commit 6d75bda

Browse files
Updating excluded_404s to excluded_http_codes
The syntaxes are taken from https://symfony.com/doc/current/logging/monolog_exclude_http_codes.html
1 parent 12d52ea commit 6d75bda

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

logging/monolog_email.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ it is broken down.
2828
action_level: critical
2929
# to also log 400 level errors (but not 404's):
3030
# action_level: error
31-
# excluded_404s:
32-
# - ^/
31+
# excluded_http_codes: [404]
3332
handler: deduplicated
3433
deduplicated:
3534
type: deduplication
@@ -62,7 +61,7 @@ it is broken down.
6261
to also log 400 level errors (but not 404's):
6362
action-level="error"
6463
And add this child inside this monolog:handler
65-
<monolog:excluded-404>^/</monolog:excluded-404>
64+
<monolog:excluded-http-code code="404"/>
6665
-->
6766
<monolog:handler
6867
name="main"
@@ -102,16 +101,15 @@ it is broken down.
102101
use Symfony\Config\MonologConfig;
103102
104103
return static function (MonologConfig $monolog) {
105-
$monolog->handler('main')
104+
$mainHandler = $monolog->handler('main')
106105
->type('fingers_crossed')
107106
// 500 errors are logged at the critical level
108107
->actionLevel('critical')
109-
// to also log 400 level errors (but not 404's):
110-
// ->actionLevel('error')
111-
// ->excluded404s(['^/'])
112-
113108
->handler('deduplicated')
114109
;
110+
// To also log 400 level errors, set the above action level to `error`.
111+
// To exclude 404's, add:
112+
$mainHandler->excludedHttpCode()->code(404);
115113
116114
$monolog->handler('deduplicated')
117115
->type('deduplication')

0 commit comments

Comments
 (0)