Skip to content

Conversation

@lyrixx
Copy link
Member

@lyrixx lyrixx commented Nov 14, 2025

Q A
License MIT
Doc issue/PR
  1. I have never seen a project with these handlers enabled.
  2. They might be difficult to configure because the server needs adjusting.
  3. Why do we set these handlers and not others?

So I think it's time to remove them.

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) November 14, 2025 10:27
@github-actions
Copy link

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1475/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1475/index.json
  2. Install the package(s) related to this recipe:

    composer req symfony/flex
    composer req 'symfony/monolog-bundle:^3.7'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

symfony/monolog-bundle

3.1 vs 3.3
diff --git a/symfony/monolog-bundle/3.1/config/packages/prod/monolog.yaml b/symfony/monolog-bundle/3.3/config/packages/prod/monolog.yaml
index 4aa906d4..bfe69c01 100644
--- a/symfony/monolog-bundle/3.1/config/packages/prod/monolog.yaml
+++ b/symfony/monolog-bundle/3.3/config/packages/prod/monolog.yaml
@@ -4,10 +4,8 @@ monolog:
             type: fingers_crossed
             action_level: error
             handler: nested
+            excluded_http_codes: [404, 405]
             buffer_size: 50 # How many messages should be saved? Prevent memory leaks
-            excluded_404s:
-                # regex: exclude all 404 errors from the logs
-                - ^/
         nested:
             type: stream
             path: "%kernel.logs_dir%/%kernel.environment%.log"
diff --git a/symfony/monolog-bundle/3.1/config/packages/test/monolog.yaml b/symfony/monolog-bundle/3.3/config/packages/test/monolog.yaml
index 2762653c..fc40641d 100644
--- a/symfony/monolog-bundle/3.1/config/packages/test/monolog.yaml
+++ b/symfony/monolog-bundle/3.3/config/packages/test/monolog.yaml
@@ -1,7 +1,12 @@
 monolog:
     handlers:
         main:
+            type: fingers_crossed
+            action_level: error
+            handler: nested
+            excluded_http_codes: [404, 405]
+            channels: ["!event"]
+        nested:
             type: stream
             path: "%kernel.logs_dir%/%kernel.environment%.log"
             level: debug
-            channels: ["!event"]
3.3 vs 3.7
diff --git a/symfony/monolog-bundle/3.3/config/packages/dev/monolog.yaml b/symfony/monolog-bundle/3.3/config/packages/dev/monolog.yaml
deleted file mode 100644
index 71554587..00000000
--- a/symfony/monolog-bundle/3.3/config/packages/dev/monolog.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-monolog:
-    handlers:
-        main:
-            type: stream
-            path: "%kernel.logs_dir%/%kernel.environment%.log"
-            level: debug
-            channels: ["!event"]
-        console:
-            type: console
-            process_psr_3_messages: false
-            channels: ["!event", "!doctrine", "!console"]
diff --git a/symfony/monolog-bundle/3.7/config/packages/monolog.yaml b/symfony/monolog-bundle/3.7/config/packages/monolog.yaml
new file mode 100644
index 00000000..bb597086
--- /dev/null
+++ b/symfony/monolog-bundle/3.7/config/packages/monolog.yaml
@@ -0,0 +1,55 @@
+monolog:
+    channels:
+        - deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
+
+when@dev:
+    monolog:
+        handlers:
+            main:
+                type: stream
+                path: "%kernel.logs_dir%/%kernel.environment%.log"
+                level: debug
+                channels: ["!event"]
+            console:
+                type: console
+                process_psr_3_messages: false
+                channels: ["!event", "!doctrine", "!console"]
+
+when@test:
+    monolog:
+        handlers:
+            main:
+                type: fingers_crossed
+                action_level: error
+                handler: nested
+                excluded_http_codes: [404, 405]
+                channels: ["!event"]
+            nested:
+                type: stream
+                path: "%kernel.logs_dir%/%kernel.environment%.log"
+                level: debug
+
+when@prod:
+    monolog:
+        handlers:
+            main:
+                type: fingers_crossed
+                action_level: error
+                handler: nested
+                excluded_http_codes: [404, 405]
+                channels: ["!deprecation"]
+                buffer_size: 50 # How many messages should be saved? Prevent memory leaks
+            nested:
+                type: stream
+                path: php://stderr
+                level: debug
+                formatter: monolog.formatter.json
+            console:
+                type: console
+                process_psr_3_messages: false
+                channels: ["!event", "!doctrine"]
+            deprecation:
+                type: stream
+                channels: [deprecation]
+                path: php://stderr
+                formatter: monolog.formatter.json
diff --git a/symfony/monolog-bundle/3.3/config/packages/prod/deprecations.yaml b/symfony/monolog-bundle/3.3/config/packages/prod/deprecations.yaml
deleted file mode 100644
index 920a0619..00000000
--- a/symfony/monolog-bundle/3.3/config/packages/prod/deprecations.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-# As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists
-#monolog:
-#    channels: [deprecation]
-#    handlers:
-#        deprecation:
-#            type: stream
-#            channels: [deprecation]
-#            path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
diff --git a/symfony/monolog-bundle/3.3/config/packages/prod/monolog.yaml b/symfony/monolog-bundle/3.3/config/packages/prod/monolog.yaml
deleted file mode 100644
index bfe69c01..00000000
--- a/symfony/monolog-bundle/3.3/config/packages/prod/monolog.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-monolog:
-    handlers:
-        main:
-            type: fingers_crossed
-            action_level: error
-            handler: nested
-            excluded_http_codes: [404, 405]
-            buffer_size: 50 # How many messages should be saved? Prevent memory leaks
-        nested:
-            type: stream
-            path: "%kernel.logs_dir%/%kernel.environment%.log"
-            level: debug
-        console:
-            type: console
-            process_psr_3_messages: false
-            channels: ["!event", "!doctrine"]
diff --git a/symfony/monolog-bundle/3.3/config/packages/test/monolog.yaml b/symfony/monolog-bundle/3.3/config/packages/test/monolog.yaml
deleted file mode 100644
index fc40641d..00000000
--- a/symfony/monolog-bundle/3.3/config/packages/test/monolog.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-monolog:
-    handlers:
-        main:
-            type: fingers_crossed
-            action_level: error
-            handler: nested
-            excluded_http_codes: [404, 405]
-            channels: ["!event"]
-        nested:
-            type: stream
-            path: "%kernel.logs_dir%/%kernel.environment%.log"
-            level: debug
diff --git a/symfony/monolog-bundle/3.3/manifest.json b/symfony/monolog-bundle/3.7/manifest.json
index 1dc6c694..ed73c591 100644
--- a/symfony/monolog-bundle/3.3/manifest.json
+++ b/symfony/monolog-bundle/3.7/manifest.json
@@ -5,5 +5,8 @@
     "copy-from-recipe": {
         "config/": "%CONFIG_DIR%/"
     },
-    "aliases": ["log", "logger", "logging", "logs", "monolog"]
+    "aliases": ["log", "logger", "logging", "logs", "monolog"],
+    "conflict": {
+        "symfony/framework-bundle": "<5.3"
+    }
 }

@symfony-recipes-bot symfony-recipes-bot merged commit 6aa652f into symfony:main Nov 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants