How to Configure Monolog to Exclude Specific HTTP Codes from the Log ¶
Sometimes your logs become flooded with unwanted HTTP errors, for example,
403s and 404s. When using a fingers_crossed handler, you can exclude
logging these HTTP codes based on the MonologBundle configuration:
ログが不要な HTTP エラー (403 や 404 など) でいっぱいになることがあります。 finger_crossed ハンドラーを使用する場合、MonologBundle 構成に基づいてこれらの HTTP コードのログを除外できます。
-
YAML
YAML
-
XML
XML
-
PHP
PHP
1 2 3 4 5 6 7 8 |
# config/packages/prod/monolog.yaml
monolog:
handlers:
main:
# ...
type: fingers_crossed
handler: ...
excluded_http_codes: [403, 404, { 400: ['^/foo', '^/bar'] }]
|
Caution
注意
Combining excluded_http_codes with a passthru_level lower than
error (i.e. debug, info, notice or warning) will not
actually exclude log messages for those HTTP codes because they are logged
with level of error or higher and passthru_level takes precedence
over the HTTP codes being listed in excluded_http_codes.
除外された_http_codes をエラーよりも低い passthru_level (つまり、debug、info、notice、または warning) と組み合わせても、これらの HTTP コードのログ メッセージは実際には除外されません。これは、これらの HTTP コードのログ メッセージは、error またはそれ以上のレベルでログに記録され、passthru_level は、excluded_http_codes にリストされている HTTP コードよりも優先されるためです。