1.x would log its activity which made it much easier to debug when things went wrong.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stewart.adam’s picture

Status: Active » Needs review
FileSize
2.31 KB

Patch attached that adds basic logging to the following rules reactions:

  1. Creation of a new recurring entity
  2. Creation of a new order
  3. Automated deactivation of a recurring entity

The change commerce_recurring_stop_recurring() may need some tweaking later, I believe that I assume all recurring entities have the product field which may not be true for the recurring order case.

pcambra’s picture

Status: Needs review » Needs work

Seems a quite specific approach here... looks like we need a debug mode maybe...

+++ b/commerce_recurring.module
@@ -558,6 +558,12 @@ function commerce_recurring_stop_recurring($recurring_entity) {
+  $product_wrapper = $recurring_wrapper->commerce_recurring_ref_product;

Duplicated line

+++ b/commerce_recurring.module
@@ -558,6 +558,12 @@ function commerce_recurring_stop_recurring($recurring_entity) {
+  $message = 'Set recurring entity for product @product_title (@product_sku) to disabled status.';
+  $variables = array('@product_title' => $product->title->value(), '@product_sku' => $product->sku->value());

No need of the variable, let's put everything in the watchdog

+++ b/commerce_recurring.rules.inc
@@ -413,6 +413,10 @@ function commerce_recurring_rules_generate_recurring_product($order, $line_item,
+  $message = 'Creating new recurring entity for product @product_title (@product_sku) from parent order @order_id';
+  $variables = array('@product_title' => $product_wrapper->title->value(), '@product_sku' => $product_wrapper->sku->value(), '@order_id' => $order->order_id);
+  watchdog('commerce_recurring', $message, $variables, WATCHDOG_INFO);

Ditto

+++ b/commerce_recurring.rules.inc
@@ -499,6 +503,11 @@ function commerce_recurring_rules_generate_order_from_recurring() {
+  $message = 'Created new order @order_id from recurring entity for product @product_title (@product_sku).';
+  $variables = array('@order_id' => $order->order_id, '@product_title' => $product_wrapper->title->value(), '@product_sku' => $product_wrapper->sku->value());
+  watchdog('commerce_recurring', $message, $variables, WATCHDOG_INFO);

Ditto

rerooting’s picture

Any chance we could see a message module integration along these lines as well? Seperate issue?

pcambra’s picture

I rather expose a message integration than log manually