Skip to main content
added 626 characters in body
Source Link
sv3n
  • 11.7k
  • 7
  • 41
  • 73

The object $itemsis not empty, it is just to large to log ... sowrite it to logfile. This breaks the observer method and your last Mage::log('function end') is not reached. Try this instead:

For debugging of large objects you should use debug() the that works with every type of Varien Object. Advantage over var_dump or print_r is that it will leave out all recursive data and keeps your log small.

/**
 * Present object data as string in debug mode
 *
 * @param mixed $data
 * @param array $objects
 * @return string
 */
public function newOrderdebug(Varien_Event_Observer$data=null, $observer&$objects=array())
{
    $orderif (is_null($data)) {
        $hash = $observer->getOrderspl_object_hash($this);
    Mage::log(array_keys    if ($order->getData!empty($objects[$hash])), null,{
 'new           return '*** RECURSION ***';
        }
        $objects[$hash] = true;
        $data = $this-order.log'>getData();
    Mage::log($order->getData}
    ...
}

Try this instead ...

public function newOrder('your_key'Varien_Event_Observer $observer),
{
 null, 'new  $order = $observer-order.log'>getOrder();
    Mage::log(get_class_methods$items->debug($order), null, 'new-order.log');
}

Same for $items.

You can also use:

    # only get available data keys
    Mage::log($itemsarray_keys($order->debug>getData()), null, 'new-order.log');
}

The object $items is just to large to log ... so it breaks the observer method and last Mage::log() is not reached. Try this instead:

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
    Mage::log($order->getData('your_key'), null, 'new-order.log');
    Mage::log(get_class_methods($order), null, 'new-order.log');
}

Same for $items.

You can also use:

Mage::log($items->debug(), null, 'new-order.log');

The object is not empty, it is just to large to write it to logfile. This breaks the observer method and your last Mage::log('function end') is not reached.

For debugging of large objects you should use debug() the that works with every type of Varien Object. Advantage over var_dump or print_r is that it will leave out all recursive data and keeps your log small.

/**
 * Present object data as string in debug mode
 *
 * @param mixed $data
 * @param array $objects
 * @return string
 */
public function debug($data=null, &$objects=array())
{
    if (is_null($data)) {
        $hash = spl_object_hash($this);
        if (!empty($objects[$hash])) {
            return '*** RECURSION ***';
        }
        $objects[$hash] = true;
        $data = $this->getData();
    }
    ...
}

Try this instead ...

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log($items->debug(), null, 'new-order.log');

    # only get available data keys
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
}
added 7 characters in body
Source Link
sv3n
  • 11.7k
  • 7
  • 41
  • 73

The object $items is just to large to log ... so it breaks the observer method and last methodMage::log() is not reached. Try this instead:

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
    Mage::log($order->getData('your_key'), null, 'new-order.log');
    Mage::log(get_class_methods($order), null, 'new-order.log');
}

Same for $items.

You can also use:

Mage::log($items->debug(), null, 'new-order.log');

The object $items is just to large to log ... so it breaks the observer method and last method is not reached. Try this instead:

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
    Mage::log($order->getData('your_key'), null, 'new-order.log');
    Mage::log(get_class_methods($order), null, 'new-order.log');
}

Same for $items.

You can also use:

Mage::log($items->debug(), null, 'new-order.log');

The object $items is just to large to log ... so it breaks the observer method and last Mage::log() is not reached. Try this instead:

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
    Mage::log($order->getData('your_key'), null, 'new-order.log');
    Mage::log(get_class_methods($order), null, 'new-order.log');
}

Same for $items.

You can also use:

Mage::log($items->debug(), null, 'new-order.log');
deleted 2 characters in body
Source Link
sv3n
  • 11.7k
  • 7
  • 41
  • 73

TheseThe object $itemsare is just to large to log ... so it breaks the observer method and last method is not reached. Try this instead:

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
    Mage::log($order->getData('your_key'), null, 'new-order.log');
    Mage::log(get_class_methods($order), null, 'new-order.log');
}

Same for $items.

You can also use:

Mage::log($items->debug(), null, 'new-order.log');

These object $itemsare just to large to log ... so it breaks the observer method and last method is not reached. Try this instead:

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
    Mage::log($order->getData('your_key'), null, 'new-order.log');
    Mage::log(get_class_methods($order), null, 'new-order.log');
}

Same for $items.

You can also use:

Mage::log($items->debug(), null, 'new-order.log');

The object $items is just to large to log ... so it breaks the observer method and last method is not reached. Try this instead:

public function newOrder(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    Mage::log(array_keys($order->getData()), null, 'new-order.log');
    Mage::log($order->getData('your_key'), null, 'new-order.log');
    Mage::log(get_class_methods($order), null, 'new-order.log');
}

Same for $items.

You can also use:

Mage::log($items->debug(), null, 'new-order.log');
Source Link
sv3n
  • 11.7k
  • 7
  • 41
  • 73
Loading