---
title: "How to get a list of events generated when you perform any action in Magento 2"
url: "https://magecomp.com/blog/get-list-events-generated-perform-action-magento-2/"
date: "2018-10-01T16:03:07+00:00"
modified: "2025-02-21T09:21:13+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 335
reading_time: "2 min read"
summary: "You are probably familiar with a concept of an event whether you are a programmer or not. Basically, the event is an action that occurs in a response of the user interaction such as a user logged i..."
description: "You are probably familiar an event that occurs in a response of the user interaction and it passes data to observers and this observer runs the logic. But wh..."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Override a Helper File in Magento 2"
    url: "https://magecomp.com/blog/override-a-helper-file-magento-2/"
  - title: "How to Use Local &#038; Cookie Storage using JavaScript modules in Magento 2"
    url: "https://magecomp.com/blog/use-local-cookie-storage-using-javascript-modules-in-magento-2/"
  - title: "How to Add Dynamic CMS Block Programmatically in Magento 2?"
    url: "https://magecomp.com/blog/add-dynamic-cms-block-programmatically-magento-2/"
---

# How to get a list of events generated when you perform any action in Magento 2

_Published: October 1, 2018_  
_Author: Dhiren Vasoya_  

![How to track list of event generated while any Action Perform Magento 2](https://magecomp.com/blog/wp-content/uploads/2018/10/How-to-track-list-of-event-generated-while-any-Action-Perform-Magento-2-1024x332.webp)

You are probably familiar with a concept of an event whether you are a programmer or not. Basically, the event is an action that occurs in a response of the user interaction such as a user logged in, a user logged out, add to cart etc. And when an event occurs it passes data to observers and the observer runs the logic you have created.

[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-2.webp)](https://magecomp.com/services/magento-upgrade-services/)
But when there are a thousand lines of code and you want to create a particular event trigger, it becomes difficult to identify what existing events are triggered when you perform any action. To help Magento devs by saving their valuable time and efforts, we came up with a small code that will help you to get a list of events generated when you perform any Action.
To get a list of events we have to perform just two easy steps.

Firstly, we need to create ‘**di.xml**‘ file inside our extension folder at below path using following code.
**app\code\Vendor\Extension\etc\di.xml**

```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <type name="MagentoFrameworkEventManagerInterface">
        <plugin name="list_all_dispatched_event" type="VendorExtensionPluginListDispatchedEvents" sortOrder="10" disabled="false"/>
    </type>
</config>
```

[![Magento Malware Removal](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-Malware-Removal-CTA-4.webp)](https://magecomp.com/magento-malware-removal.html)

Now, we need to create on more file ‘**ListDispatchedEvents.php**‘ inside our extension folder.
**app\code\Vendor\Extension\Plugin\ListDispatchedEvents.php**

```
<?php

namespace VendorExtensionPlugin;
class ListDispatchedEvents
{
    public function beforeDispatch($subject, $eventName, array $data = [])
    {
        $writer = new ZendLogWriterStream(BP . '/var/log/event.log');
        $logger = new ZendLogLogger();
        $logger->addWriter($writer);
        $logger->info($eventName);
    }

}
```

Tadaa! Your list of events is generated inside an event.log file which resides inside var/log folder. You can use this code anywhere to grab existing events list which triggered when you make any action.

[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-3.webp)](https://magecomp.com/magento-performance-optimization.html)
And yes, please hit that stars if this code worked for you or comment down below if you face any issue.

Happy Coding?


---

_View the original post at: [https://magecomp.com/blog/get-list-events-generated-perform-action-magento-2/](https://magecomp.com/blog/get-list-events-generated-perform-action-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-07-04 10:11:04 UTC_  
