Ready to be ported

Important NOTE:

Some rules may look like they failed but this is expected behaviour. If you have 2 rules on entity insert on different bundles they will both be triggered when you insert a node but only the right bundle will have success.

Problem/Motivation

Often I'm forced to add all these watchdog loggers to be able to check if a rule or an action has been fired.
Many of the rules and action are fired on CRON runs or triggered on REST requests and routes.

Proposed resolution

Have a sub-module with an custom entity much similar to watchdog and trasfer the data from business_rules to this and display it with dbug styling when visited.

Remaining tasks

  • Generate sub-module with drupal console
  • Generate entity to sub-module with drupal console
  • Add general fields to entity
  • Add serialized data field
  • Add API to log data
  • #3076276: Integrate br_logs with business_rules
  • Process all required data from business_rules into br_logs
  • Add views UI and settings
  • Integrate dbug into log entity display

User interface changes

Logs are located at: /admin/reports/br_log

Enable the logging in /admin/config/workflow/business_rules/settings

Issues

Fixed:

Infinite loop:

When I integrate the services of br_logs into business_rules I get an infinte loop, this behavior does not happen on dpm() or watchdog.

Please read the README.txt for more details located in br_logs sub-module.

API
---
          // Information to be stored with the log.
          $fields = [
            'description' => $rule_data['#description'],
            'items' => $rule_items,
            'rule_status' => $rule_status,
            'variables' => $variables,
          ];

          // Call br_logs service
          \Drupal::service('br_logs')
            ->rulesLogger($type = $rule_id, $rule_data['#title'], $rule_data, $fields);

Comments

lexsoft created an issue. See original summary.

c.e.a’s picture

Issue tags: +br-beta-9

Sounds great!

lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

StatusFileSize
new30.98 KB
new13.08 KB
patch -p1 < br_logs_submodule-3075401-4.patch
patching file modules/br_logs/README.txt
patching file modules/br_logs/br_log.page.inc
patching file modules/br_logs/br_logs.info.yml
patching file modules/br_logs/br_logs.links.menu.yml
patching file modules/br_logs/br_logs.links.task.yml
patching file modules/br_logs/br_logs.module
patching file modules/br_logs/br_logs.permissions.yml
patching file modules/br_logs/br_logs.services.yml
patching file modules/br_logs/src/BusinessRuleLogAccessControlHandler.php
patching file modules/br_logs/src/BusinessRuleLogHtmlRouteProvider.php
patching file modules/br_logs/src/BusinessRuleLogListBuilder.php
patching file modules/br_logs/src/BusinessRulesLoggerManager.php
patching file modules/br_logs/src/BusinessRulesLoggerManagerInterface.php
patching file modules/br_logs/src/Entity/BusinessRuleLog.php
patching file modules/br_logs/src/Entity/BusinessRuleLogInterface.php
patching file modules/br_logs/src/Entity/BusinessRuleLogViewsData.php
patching file modules/br_logs/src/Form/BusinessRuleLogDeleteForm.php
patching file modules/br_logs/src/Form/BusinessRuleLogForm.php
patching file modules/br_logs/src/Form/BusinessRuleLogSettingsForm.php
patching file modules/br_logs/templates/br_log.html.twig
lexsoft00’s picture

Status: Active » Needs review
lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

StatusFileSize
new42.02 KB

br_logs

Note: This includes the patch from Integrate br_logs with business_rules

        new file:   modules/br_logs/README.txt
        new file:   modules/br_logs/br_log.page.inc
        new file:   modules/br_logs/br_logs.info.yml
        new file:   modules/br_logs/br_logs.links.menu.yml
        new file:   modules/br_logs/br_logs.links.task.yml
        new file:   modules/br_logs/br_logs.module
        new file:   modules/br_logs/br_logs.permissions.yml
        new file:   modules/br_logs/br_logs.services.yml
        new file:   modules/br_logs/br_logs.views_execution.inc
        new file:   modules/br_logs/src/BusinessRuleLogAccessControlHandler.php
        new file:   modules/br_logs/src/BusinessRuleLogHtmlRouteProvider.php
        new file:   modules/br_logs/src/BusinessRuleLogListBuilder.php
        new file:   modules/br_logs/src/BusinessRulesLoggerManager.php
        new file:   modules/br_logs/src/BusinessRulesLoggerManagerInterface.php
        new file:   modules/br_logs/src/Entity/BusinessRuleLog.php
        new file:   modules/br_logs/src/Entity/BusinessRuleLogInterface.php
        new file:   modules/br_logs/src/Entity/BusinessRuleLogViewsData.php
        new file:   modules/br_logs/src/Form/BusinessRuleLogDeleteForm.php
        new file:   modules/br_logs/src/Form/BusinessRuleLogForm.php
        new file:   modules/br_logs/src/Form/BusinessRuleLogSettingsForm.php
        new file:   modules/br_logs/templates/br_log.html.twig
        modified:   src/Form/BusinessRulesSettingsForm.php
        modified:   src/Util/BusinessRulesProcessor.php
patch -p1 < ../br_logs_submodule-3075401-12.patch
patching file modules/br_logs/README.txt
patching file modules/br_logs/br_log.page.inc
patching file modules/br_logs/br_logs.info.yml
patching file modules/br_logs/br_logs.links.menu.yml
patching file modules/br_logs/br_logs.links.task.yml
patching file modules/br_logs/br_logs.module
patching file modules/br_logs/br_logs.permissions.yml
patching file modules/br_logs/br_logs.services.yml
patching file modules/br_logs/br_logs.views_execution.inc
patching file modules/br_logs/src/BusinessRuleLogAccessControlHandler.php
patching file modules/br_logs/src/BusinessRuleLogHtmlRouteProvider.php
patching file modules/br_logs/src/BusinessRuleLogListBuilder.php
patching file modules/br_logs/src/BusinessRulesLoggerManager.php
patching file modules/br_logs/src/BusinessRulesLoggerManagerInterface.php
patching file modules/br_logs/src/Entity/BusinessRuleLog.php
patching file modules/br_logs/src/Entity/BusinessRuleLogInterface.php
patching file modules/br_logs/src/Entity/BusinessRuleLogViewsData.php
patching file modules/br_logs/src/Form/BusinessRuleLogDeleteForm.php
patching file modules/br_logs/src/Form/BusinessRuleLogForm.php
patching file modules/br_logs/src/Form/BusinessRuleLogSettingsForm.php
patching file modules/br_logs/templates/br_log.html.twig
patching file src/Form/BusinessRulesSettingsForm.php
patching file src/Util/BusinessRulesProcessor.php
lexsoft00’s picture

Issue summary: View changes
StatusFileSize
new101.12 KB
new198.2 KB
lexsoft00’s picture

Issue summary: View changes
lexsoft00’s picture

Issue summary: View changes
vrwired’s picture

StatusFileSize
new42.05 KB

For those who still use this module, I've update patch from #12 for D10 compatibility.

vrwired’s picture

StatusFileSize
new42.05 KB

Had typo in last patch's name, this fixes it