diff --git a/logging/monolog_exclude_http_codes.rst b/logging/monolog_exclude_http_codes.rst new file mode 100644 index 00000000000..27984836f4f --- /dev/null +++ b/logging/monolog_exclude_http_codes.rst @@ -0,0 +1,65 @@ +.. index:: + single: Logging + single: Logging; Exclude HTTP Codes + single: Monolog; Exclude HTTP Codes + +How to Configure Monolog to Exclude Specific HTTP Codes from the Log +==================================================================== + +..versionadded:: 4.1 + The ability to exclude log messages based on their status codes was + introduced in Symfony 4.1 and MonologBundle 3.3. + +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: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/prod/monolog.yaml + monolog: + handlers: + main: + # ... + type: fingers_crossed + handler: ... + excluded_http_codes: [403, 404, { 400: ['^/foo', '^/bar'] }] + + .. code-block:: xml + + + + + + + + + ^/foo + ^/bar + + + + + + + .. code-block:: php + + // config/packages/prod/monolog.php + $container->loadFromExtension('monolog', array( + 'handlers' => array( + 'main' => array( + // ... + 'type' => 'fingers_crossed', + 'handler' => ..., + 'excluded_http_codes' => array(403, 404), + ), + ), + )); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy