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

Command icon 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

nitesh624 created an issue. See original summary.

adityarawat_ln made their first commit to this issue’s fork.

nitesh624’s picture

Latest 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)
Only local images are allowed.
Should this be at Activities Config admin/config/activities path ?
Only local images are allowed.

nitesh624’s picture

Status: Active » Needs review
nitesh624’s picture

Just wanted to see any opinion from community on location of checkbox. Otherwise functionality seems to be working fine for me +1RTBC from my side.

dpagini’s picture

Status: Needs review » Reviewed & tested by the community

Working in a project we're using this in....