How to get Magento 2 events/observers

- Magento 2

Magento 2 Development

You can get the list of events/observers in Magento 2 in the \Magento\Framework\Event\Manager::dispatch() method. Since there is no access to the logger, you will have to add a logger instance in the constructor:

Now, call in the dispatch method:

Instead of info you can use \Psr\Log\LoggerInterface methods.

Source (Magento Stackexchange question) (Marius♦)

More Magento 2 tips from the Cookbook