Cycle printing when I use :logger.log of Erlang in Logger backend of Elixir

Hi,

The message is printed cyclically when I use :logger.log of Erlang in Logger backend of elixir 1.10.

Here is my code in Logger Backend:
def handle_event({level, _, {Logger, message, timestamp, metadata}}, state) do
:logger.log(level, message)
{:ok, state}
end

How could I use the :logger.log in Logger Backend?

Thanks

Elixirs logger is using the erlang logger by default, wo when you do :logger.log, you basically call your handler, as that handler is registered as a handler for the logger.

3 Likes