-
-
Notifications
You must be signed in to change notification settings - Fork 504
[symfony/monolog-bundle] Adding deprecation_deduplication handler
#1500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ThomasLandauer
wants to merge
1
commit into
symfony:main
Choose a base branch
from
ThomasLandauer:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just an idea: Wouldn't a deduplication handler make sense here? I mean, who needs the same deprecation message 10.000 times?
|
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. symfony/monolog-bundle3.1 vs 3.3diff --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.7diff --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..143e7afc
--- /dev/null
+++ b/symfony/monolog-bundle/3.7/config/packages/monolog.yaml
@@ -0,0 +1,59 @@
+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_deduplication:
+ type: deduplication
+ channels: [deprecation]
+ handler: deprecation
+ time: 86400 # 1 day
+ deprecation:
+ type: stream
+ 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"
+ }
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Just an idea: Wouldn't a deduplication handler make sense here? I mean, who needs the same deprecation message 10.000 times?