Add option to log deprecation errors to prepare for Drupal 11

Created on 7 January 2019, over 6 years ago
Updated 2 August 2024, 8 months ago

Problem/Motivation

Dries had this IMHO great idea in https://twitter.com/Dries/status/1081582626560008192 I'd also love to see a "Log deprecated code" setting in /admin so you can also identify deprecated code without having to run tests. which could be a good way to turn on and let it run for a while to audit for problems. Proper tools to vet the results would still be important (dependencies will throw these errors, some errors should not be fixed too soon without core updates, etc), but we need some way to collect the data first.

User stories from #20:

  1. As a site owner, I want to see if my site can be upgraded to Drupal 9 (e.g. there should be no deprecations).
  2. As a developer, I want to see what deprecations I have to remove. Because I have to manage custom code, I'd like to know the module, file name and line number of the deprecated code.

Proposed resolution

Add logic to _drupal_error_handler_real to used the configuration values to determine if a message should be logged.
The configuration allows one to

  • Enable/disable the logging of deprecation messages
  • Filter messages bases on file path
  • Filter messages by the message text

Remaining tasks

Get testing to work and likely add more test cases.

  • Discuss log retention around these messages, these may generate a lot of logs fast, but at the same time aggregate results out of it would be *really* useful to prioritise work on a site.
  • In separate issue: discuss ways to improve making sense of this data, currently messages logged this way don't really stand out in logs and hard to filter for (they show up alongside other 'php' sourced errors and no further filter to filter to deprecated things or to aggregate them and see volumes):

User interface changes

after

API changes

None.

Data model changes

None.

Release notes snippet

TBD.

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Baseย  โ†’

Last updated about 12 hours ago

Created by

๐Ÿ‡ญ๐Ÿ‡บHungary Gรกbor Hojtsy Hungary

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024