Problem/Motivation
We previously used a text field with rudimentary validation for phone numbers for the user entity, then we installed this module and migrated the existing data using an SQL query. The policy is that each user has to correct their own phone number when updating their own account.
But sometimes we have to update user entities in bulk, either through the UI or programmatically, and for large numbers of users this pollutes watchdog with number format errors, pushing useful watchdog messages out. This is also annoying when running drush commands and the console fills up with these errors.
We've been using a custom patch that just removes the error logging, but a decision would have to be made by maintainers whether to remove it completely, or disable it based on a setting, or replace the watchdog logging with status messages (which would just spam the UI instead of watchdog so this wouldn't really be an improvement), etc. I guess a check could be made if the field belongs to an entity that is an instance of UserInterface and the current user has the same ID and only log an error in that case, but there could also be a considerable amount of use cases where the field belongs to a entity that is an instance of ProfileInterface and checking that would introduce undesired dependency complications.
Proposed resolution
The watchdog errors seem unnecessary to me regardless of use case, so I suggest removing them completely.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | disable-number-format-error-logging-4.x.patch | 1.6 KB | ts.ag |
| #2 | disable-number-format-error-logging-3.x.patch | 930 bytes | ts.ag |
Comments
Comment #2
ts.ag commentedFor those who wish to disable the logging of these errors, I'm attaching patch files to use in Composer with 3.x and 4.x.
Comment #4
saidatom