Phoenix Logger does not take in consideration the event_prefix

I encountered a problem recently trying to listen for Phoenix.Logger events in Phoenix Dasbboard.
Since I have multiple phoenix applications running into my all as separate umbrella applications I appended specific event prefix to Plug.Telemetry like this:

plug(Plug.Telemetry, event_prefix: [:payments_api, :phoenix, :endpoint])

Telemetry plug is taking in consideration the event prefix correctly. Phoenix.Logger instead does not. Handlers are hardcoded and the event names can not be configured as you can see here: phoenix/logger.ex at d106fbef5366761669c7dbc34931996fc5a30c30 · phoenixframework/phoenix · GitHub.
Should we not be able to configure the logger prefix also? I want your opinion before spamming phoenix repo with pull requests.

Yes, the Phoenix logger only handles its own prefix. If you are using another one, we assume it is because you don’t want Phoenix to hook into it. I am not sure this is something we would change. You can always plug in your own logging too!

1 Like

Having multiple Phoenix applications in the same VM is a common scenario and collecting separate metrics for each it’s required in this case. Being able to append a prefix like Plug.Telemetry does seems like a nice way to do it in my opinion instead of duplicating code for entire Phoenix.Logger.