Is there a way to listen for all events being fired in the system?

I want to know which events are being fired during specific flow?

For example:
If i can see all the events being fired during login process on terminal?

What do you want to see? Do you want to see the Nextcloud logs?

If yes, you can change the loglevel

For seeing the logs directly you can then use:

tail -f /path/to/nextcloud/data/nextcloud.log

Maybe you want another log:
tail -f /path/to/nextcloud/data/flow.log

No not logs.

Events like UserCreated, PostLogin, PreLogin etc.

Hello @Hammad,

no, this is not possible, I am sorry. The EventDispatcher uses the EventDispatcher of Symfony. The request for a catch-all event listener was not followed (see here).

If it is only for debugging purposes, you could query the server code for the OC\EventDispatcher\EventDispatcher object (note the private namespace OC, not for production!), and use the method getSymfonyDispatcher() to get hold on the symfony dispatcher. Maybe you can use that as a starting point to install a bundle to allow for wildcard evnts.

I have read during a quick research, that you can register a generic Event listener. I am not so sure, this will work out with nextcloud involved.

I fear, you will have to inspect the source code and look for the event dispatcher in whatever source (be it an app or the core), you expect the event to be triggered. Then you can register a listener and log that in the regular way.

2 Likes