Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc257763

Browse files
committed
Introduce dedicated logger channel for deprecations
1 parent746d9c9 commitc257763

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

‎setup/upgrade_major.rst

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ using these deprecated features in the last version before the major (e.g.
3737
you should first:doc:`upgrade to the last minor version</setup/upgrade_minor>`
3838
(e.g. 4.4) so that you can see *all* the deprecations.
3939

40+
Deprecations in Web Debug Toolbar
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42+
4043
To help you find deprecations, notices are triggered whenever you end up
4144
using a deprecated feature. When visiting your application in the
4245
:ref:`dev environment<configuration-environments>`
@@ -84,7 +87,7 @@ Now, you can start fixing the notices:
8487
OK (10 tests, 20 assertions)
8588
8689
Remaining deprecation notices (6)
87-
90+
8891
The "request" service is deprecated and will be removed in 3.0. Add a type-hint for
8992
Symfony\Component\HttpFoundation\Request to your controller parameters to retrieve the
9093
request instead: 6x
@@ -124,6 +127,48 @@ done!
124127
125128
$ SYMFONY_DEPRECATIONS_HELPER=max[total]=999999 php ./bin/phpunit
126129
130+
Deprecations in logs
131+
~~~~~~~~~~~~~~~~~~~~
132+
If you use the Symfony default configuration, the deprecations are also logged in a ``prod.deprecations.log`` file (prod environment):
133+
134+
..code-block::yaml
135+
136+
monolog:
137+
handlers:
138+
# ...
139+
deprecation:
140+
type:stream
141+
path:"%kernel.logs_dir%/%kernel.environment%.deprecations.log"
142+
deprecation_filter:
143+
type:filter
144+
handler:deprecation
145+
max_level:info
146+
channels:["php"]
147+
148+
Under the hood, deprecations are logged on the ``php`` Monolog channel at ``INFO`` psr-3 level. But as soon as an extra ``deprecation`` channel exists; deprecations are logged into this channel instead. So you can log deprecations on this dedicated channel and make the ``deprecation_filter`` useless:
149+
150+
..code-block::yaml
151+
152+
monolog:
153+
channels:
154+
-deprecation
155+
handlers:
156+
# ...
157+
deprecation:
158+
type:stream
159+
channels:["deprecation"]
160+
path:"%kernel.logs_dir%/%kernel.environment%.deprecations.log"
161+
162+
..versionadded::5.1
163+
164+
The deprecation logging into a dedicated channel was introduced in Symfony 5.1.
165+
166+
Road to Code Deprecation Free
167+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
168+
1. Track the deprecations from the PHPUnit bridge and/or (depending on your test coverage) browse your application and note the deprecations on the web debug toolbar.
169+
2. Deploy your code (that should not have deprecations anymore) on production and check for a while that no remaining deprecations are logged into ``prod.deprecations.log``.
170+
3. When you're sure there is no more deprecations, follow the steps below to upgrade your application.
171+
127172
.. _upgrade-major-symfony-composer:
128173

129174
2) Update to the New Major Version via Composer

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp