It's worth noting that for some reason, Statamic doesn't save data when the EventCollector is enabled.
One of the most useful tools in your arsenal when working with Statamic – especially when working with non-view data – is the debug bar. However, it is only as useful as the information that it outputs, which when it comes to events, isn’t much.
It doesn’t have to be that way, though. The debug bar in Statamic is a Laravel wrapper around the PHP debug bar. It’s an incredibly useful tool, but if you’ve only ever used it in the context of Statamic, you might not realise that it’s capable of a lot more than how it is configured out of the box.
One of the most powerful parts of the debug bar – provided you’re working with events of course – is the EventsCollector. The EventsCollector gives you a clear overview of all of the events that have been, and are being, fired.
However, it isn’t turned on by default in Statamic. It’s relatively simply to do though.
The file you’re after is
statamic/config/debugbar.php. On line 84 (as of 2.11.12), you’ll see an option in the
collectors array called
events. It’s set to false; change it to true and save.
Now, provided you have enabled your debug bar, you will see a new tab called events. This will output every event fired, including any custom ones you might be working on.
It’s worth noting that the config file exists in the Statamic directory. As such, if you update your version of Statamic, you will need to change the settings again. I’m going to raise a FR and possibly a PR to the gents to expose these options within the env file, but with them working on v3, I don’t know how long it will be before it’s available.