Stop log messages for channels

I have an Elm frontend and a Phoenix backend that communicate over a channel.
This results in a flood of log messages, e.g.,the following over and over again.
How can I supress it?

[debug] INCOMING "hello" on "room:lobby" to Koko.Web.RoomChannel
  Transport:  Phoenix.Transports.WebSocket
  Parameters: %{"message" => "hello"}

I’d like to see other debug messages, of course.

1 Like

Yeah, you can use Logger.disable/1.

Thanks @Azolo – where would I put that line?

You can also setup a filter on the Logger option in your config too.

In the join/3 callback should be fine.

I’m pretty sure that a new GenServer gets created for the channel subscription in that case.

Do you mean filtering the log level or a custom event filter?

The latter sounds like a interesting idea, but I haven’t seen anything like it in the docs.

You can pass configuration options to control logging:

use Phoenix.Socket, log: :error

and

use Phoenix.Channel, log_join: :error, log_handle_in: false

https://hexdocs.pm/phoenix/Phoenix.Channel.html#module-logging
https://hexdocs.pm/phoenix/Phoenix.Socket.html#module-logging

5 Likes