I am working in simple event/observer module, but it does not work. I am trying to log the message in deubug.log when click place order button.

I have listed below what I have done


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_directpost_placeOrder">
    <observer name="get_place_order" instance="Gworks\Sms\Observer\LogAddMessage"/>


<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Gworks_Sms" setup_version="1.0.0"/>


namespace Gworks\Sms\Observer;
use Magento\Framework\Event\ObserverInterface;
class LogAddMessage implements ObserverInterface
    protected $_logger;
    public function __construct(
    \Psr\Log\LoggerInterface $logger, //log injection
    array $data = []
    ) {
    $this->_logger = $logger;
    public function execute(\Magento\Framework\Event\Observer $observer)
       $this->_logger->addDebug('getplace oreder event occured successfully!');





Your event checkout_directpost_placeOrder is wrong.It is only fire whenever Payment method is Authorizenet Directpost

use sales_order_place_after event.

| improve this answer | |
  • thank you it solved @Amit Bera please update how to find right events, its become more useful answer :-) – Bilal Usean Apr 26 '16 at 6:40
  • it totally depend on my concept .directpost word give me some signel :) – Amit Bera Apr 26 '16 at 9:52
  • in which file/line sales_order_place_after is dispatched? – LucScu Aug 31 '16 at 10:17
  • you can see a list of the events in this site cyrillschumacher.com/magento2-list-of-all-dispatched-events . Thanks Amit – Ervin Jan 12 '17 at 19:52

You can use one of the events for your case.All events are used for place order after logic.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.