Problem/Motivation
- activities_user_activities_insert() writes every user_activities record to the Drupal logger as well:
- The record is already stored as an entity and shown at admin/config/system/activity.
- On sites with dblog enabled this duplicates every create, update, delete and view into watchdog.
- On busy sites that adds table growth and noise in /admin/reports/dblog.
- If a syslog or external log backend is used, every activity is also forwarded there.
- There is no setting to turn this off, and the logging is hard-coded.
Proposed resolution
Add a setting to activities.settings, for example logging.enabled or log_to_logger. The settings form would expose it as a checkbox, "Also write activity records to the system log". activities_user_activities_insert() would skip the \Drupal::logger() call when the setting is off.
Optionally, allow a log level, or move the call to a dedicated logger service. Sites could then filter it with a decorator or channel override.
Remaining tasks
- Add the config key and schema.
- Add the settings form checkbox.
- Add an update hook that sets the current behavior as the default.
- Add test coverage.
User interface changes
One new checkbox on the Activities configuration form.
API changes
None. The default stays enabled, so current behavior is unchanged.
Data model changes
One new boolean key in activities.settings, with an update hook that sets the default.
Issue fork activities-3628657
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
nitesh624Latest MR works fine for me


Just one Observation I see
the checkbox
(Also write activity records to the system log)I see at Activities Purge Settings page (admin/config/activities/purge)Should this be at Activities Config
admin/config/activitiespath ?Comment #5
nitesh624Comment #6
nitesh624Just wanted to see any opinion from community on location of checkbox. Otherwise functionality seems to be working fine for me +1RTBC from my side.
Comment #7
dpagini commentedWorking in a project we're using this in....