How to record a log message when saving a Commerce Order via Drupal EntityWrapper? I'm modifying a set of orders programmatically and want to record a log message when doing so.

Is there an existing method to add a revision and log when doing so?

$order_id = 800;
$order = commerce_order_load($order_id);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$order_wrapper-&gt;uid-&gt;set(1);
$order_wrapper-&gt;mail-&gt;set('test@example.com');
// $order_wrapper-&gt;log-&gt;set('Changed order owner and mail');
// $order_wrapper-&gt;revision-&gt;set(true);
$order_wrapper-&gt;save();


Currently if I try $order_wrapper-&gt;log-&gt;set('x'); I see EntityMetadataWrapperException: Unknown data property log., but I believe this is a property of the order (based on getPropertyInfo() etc).

Does Commerce Order + Entity Metadata Wrappers have support for creating a new revision on save, or recording an order log message?
You may need to set the revision and log properties on the default order object, instead of the wrapper.

e.g:

$order_id = 800;
$order = commerce_order_load($order_id);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$order_wrapper-&gt;uid-&gt;set(1);
$order_wrapper-&gt;mail-&gt;set('test@example.com');
// Set revision details on order object
$order-&gt;revision = TRUE;
$order-&gt;log = t('Changed order owner and mail');
$order_wrapper-&gt;save();


As the order object is passed by reference, from memory the revision log info can be set that way.