When enabling "detailed logging" for a multisite (multi-domain) installation, does logging actually need to be enabled for each domain ID? Or is it sufficient to enable logging only on the "master" site (with Civi domain ID 1)?
I've noticed that in the civicrm_setting
table, the logging
setting is stored with the domain_id
. And, in the CiviCRM admin UI, when logging is "enabled" on the site with domain ID 1, it still shows as "disabled" on other sites unless I explicitly "enable" it.
Since logging works via insert/update/delete triggers on each DB table, I cannot see how logging could be "enabled" for one domain ID but not enabled for all other domain IDs. Nonetheless, the fact that the setting appears to be independent for each site (based on both the UI and on the domain_id
value in the civicrm_setting
table) is confusing, and I have not seen this documented elsewhere.
I'm running WordPress multisite (v.5.4.4) and Civi 5.35.1.
Edit: Out of curiosity, I dug deeper and inspected the database triggers on the civicrm_contact
table after first enabling logging on both the main (domain ID 1) site and a child site, and then again after disabling logging on only the child site.
After enabling logging, there was a TRIGGER civicrm_contact_after_insert after insert ON civicrm_contact FOR EACH ROW BEGIN IF ( @civicrm_disable_logging IS NULL OR @civicrm_disable_logging = 0 ) THEN INSERT INTO ...
defined on the civicrm_contact
table. And after disabling logging on only the child site, that trigger disappeared from the civicrm_contact
table. So this seems to confirm that logging is not specific to a domain ID. But, I don't know whether or how the codebase uses the @civicrm_disable_logging
variable. Through that variable, it looks like it would be possible to disable/bypass logging on a per-site basis!
For the record, I enabled and disabled logging via the wp cv
CLI rather than the UI using (e.g.):
wp cv api setting.create logging=1 --url=main.mydomain.org
wp cv api setting.create logging=1 --url=childsite1.mydomain.org
wp cv api setting.create logging=0 --url=childsite1.mydomain.org
I did not test to see if changing settings in the UI behaves differently.