From 746d9c97cca5b23852b3d867eb2cd74b5e20eb20 Mon Sep 17 00:00:00 2001 From: Laurent VOULLEMIER Date: Tue, 5 May 2020 09:23:06 +0200 Subject: [PATCH 1/2] Add precision about deprecations triggered during warm-up process --- setup/upgrade_major.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 9c51834e577..0cde628a5ce 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -95,6 +95,10 @@ Now, you can start fixing the notices: Once you fixed them all, the command ends with ``0`` (success) and you're done! +.. note:: + + Since some deprecations may be triggered during the cache warm-up, it's recommanded to run your final deprecation check with an empty cache. + .. sidebar:: Using the Weak Deprecations Mode Sometimes, you can't fix all deprecations (e.g. something was deprecated From e4a78d97f1e5bb3f02f2edf29751478f22972288 Mon Sep 17 00:00:00 2001 From: Laurent VOULLEMIER Date: Tue, 5 May 2020 10:24:26 +0200 Subject: [PATCH 2/2] Introduce dedicated logger channel for deprecations --- setup/upgrade_major.rst | 47 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 0cde628a5ce..866b190dc65 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -37,6 +37,9 @@ using these deprecated features in the last version before the major (e.g. you should first :doc:`upgrade to the last minor version ` (e.g. 4.4) so that you can see *all* the deprecations. +Deprecations in Web Debug Toolbar +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + To help you find deprecations, notices are triggered whenever you end up using a deprecated feature. When visiting your application in the :ref:`dev environment ` @@ -84,7 +87,7 @@ Now, you can start fixing the notices: OK (10 tests, 20 assertions) Remaining deprecation notices (6) - + The "request" service is deprecated and will be removed in 3.0. Add a type-hint for Symfony\Component\HttpFoundation\Request to your controller parameters to retrieve the request instead: 6x @@ -124,6 +127,48 @@ done! $ SYMFONY_DEPRECATIONS_HELPER=max[total]=999999 php ./bin/phpunit +Deprecations in logs +~~~~~~~~~~~~~~~~~~~~ +If you use the Symfony default configuration, a part of the ``monolog`` configuration for the prod environment can be uncommented allowing to log deprecations in a ``prod.deprecations.log`` file: + +.. code-block:: yaml + + monolog: + handlers: + # ... + deprecation: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" + deprecation_filter: + type: filter + handler: deprecation + max_level: info + channels: ["php"] + +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: + +.. code-block:: yaml + + monolog: + channels: + - deprecation + handlers: + # ... + deprecation: + type: stream + channels: ["deprecation"] + path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" + +.. versionadded:: 5.1 + + The deprecation logging into a dedicated channel was introduced in Symfony 5.1. + +Road to Code Deprecation Free +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +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. +2. Deploy your code (that should not have deprecations anymore) on production and check from time to time the content of this log file to be aware of the remaining deprecations you have to change/update. +3. When you're sure there is no more deprecations, follow the steps below to upgrade your application. + .. _upgrade-major-symfony-composer: 2) Update to the New Major Version via Composer 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