some now and then i get this Rules evaluation log
although "debug mode" is clearly off.

i get it when creating a vbo view, and the rule fires on the "view node" event.

(it's not a big problem in the admin area but i dont want this for customers on a production site)

CommentFileSizeAuthor
#12 rules_error_handling.patch26.73 KBfago

Comments

fago’s picture

Component: Rules Core » Rules Engine

This is only when there were some evaluation errors, which are then printed bold. Only users with 'administer rules' permission get to see this though. Still, as this is obviously confusing users - maybe we should make setting for this?
As alternative setting, I think being silent but logging it to the watchdog would be useful. Opinions?

fago’s picture

Title: Rules evaluation log - without debug mode » improve erros and Rules evaluation log handling
Category: bug » task
geek-merlin’s picture

i would think:
* log to watchdog
* print to users with "view rules errors" permission, and inform why this is shown

fago’s picture

Related #1134308: Rules Scheduler log accumulating came up.

->
>Perhaps we want to add an option what shall be logged to the watchdog?
* All rule evaluations (warning: A lot..) ---> Probably useful, so we could skip that.
* Rule evaluations with warnings --> default
* Rule evaluations with errors --> Allows one to skip logging of warnings in case one does not care

>I don't really see need for logging all rules_schedule evaluations as we do now - except when we are in debug mode.

fago’s picture

Issue tags: +UX

adding tag

dandaman’s picture

I'm also getting a Rules Evaluation log occasionally although my site doesn't have any debugging information there. I'm interested in finding if we can make this more predictable and able to be turned off if wanted.

sepgil’s picture

I've implemented a part of this issue in this issue: http://drupal.org/node/1231026

fago’s picture

also, we should probably add in an option to completely disable the debug log for performance reasons. It's not much, but in case of long-running operations involving lots of rules processing the debug-log might eat some memory.

fago’s picture

ok, so let's use this issue for dealing with the error handling:

I think we should do the following:
* Go through the thrown exception ans raise them to the "error" level if they should never happen. If something that could be ignored, stay with WARN.
* Add a setting for what should be logged to the watchdog (see #4).
* Add a setting for completely turning off the evaluation log (production mode). In this case errors go directly in the watchdog. Else, we log the errors + mark the log to contain errors + log the whole log to the watchdog.
* Introduce a separate rules-scheduler log setting, to log a) nothing, b) which tasks have been evaluated c) everything (debugging). Error handling applies to it anyway too.

I'm not completely sure whether we really need the third setting or just implement only the production mode. It's certainly nice to be able to automatically get "debug-backtraces" once something goes wrong (as it is now).

fago’s picture

I've just improved error-handling a bit, such that exceptions are catched more reliable.
Points of #9 still apply though.

Furthermore, we might want to improve the debug-log to be auto-opened if there are errors.

klausi’s picture

The points from #9 sound good, although I think we don't have to treat rules_scheduler differently. Just add the log level settings for watchdog/debug log:
* none
* info/all
* warn
* error

Only pop up the debug log if it is a) enabled and b) the level from above is met.

fago’s picture

Status: Active » Needs review
Issue tags: +D7 stable release blocker
StatusFileSize
new26.73 KB

ok, here is a patch implementing the options. It also adjusts rules_log() such that we have the necessary information for displaying edit links in the rules log + I added those links.

fago’s picture

Status: Needs review » Fixed

and committed!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dimecris’s picture

Component: Rules Engine » Rules Core

Hello,
I do not know what I'm doing wrong. I installed these modules
commerce_coupon_pct-7.x-1.x-dev
commerce_coupon_fixed_amount-7.x-1.x-dev
commerce_coupon-7.x-1.0-beta6

I created a fixed coupon but when I entered it in the does not make me the discount. The validation of the coupon is good but the reedem doesn't work. I need to apply the coupon to the total cart.

What am I doing wrong?
I've installed and uninstalled the modules but nothing changes.
I've even tried installing commerce_coupon 7.x-1.x-dev, but does not work either

This is the rule that i apply
{ "commerce_coupon_fixed_amount_calculate_amount" : {
"LABEL" : "Redeem a coupon with fixed amount",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_coupon" ],
"ON" : [ "commerce_coupon_redeem" ],
"IF" : [
{ "data_is" : {
"data" : [ "coupon:type" ],
"op" : "=",
"value" : "commerce_coupon_fixed"
}
},
{ "entity_has_field" : { "entity" : [ "coupon" ], "field" : "commerce_coupon_fixed_amount" } },
{ "entity_has_field" : {
"entity" : [ "commerce_order" ],
"field" : "commerce_coupon_order_reference"
}
},
{ "NOT AND" : [
{ "data_is_empty" : { "data" : [ "coupon:commerce-coupon-fixed-amount" ] } }
]
},
{ "data_is" : {
"data" : [ "coupon:commerce-coupon-fixed-amount:amount" ],
"op" : "\u003e",
"value" : 0
}
},
{ "data_is" : { "data" : [ "coupon:is-active" ], "op" : "=", "value" : true } }
],
"DO" : [
{ "list_add" : {
"list" : [ "commerce-order:commerce-coupon-order-reference" ],
"item" : [ "coupon" ],
"unique" : 1
}
},
{ "commerce_coupon_action_create_coupon_line_item" : {
"USING" : {
"commerce_coupon" : [ "coupon" ],
"commerce_order" : [ "commerce-order" ],
"amount" : [ "coupon:commerce-coupon-fixed-amount:amount" ],
"component_name" : [ "coupon:price-component-name" ],
"currency_code" : [ "coupon:commerce-coupon-fixed-amount:currency-code" ]
},
"PROVIDE" : { "commerce_coupon_line_item" : { "commerce_coupon_line_item" : "commerce coupon line item" } }
}
}
]
}
}