Failing to remove info level logs from plug and phoenix

Actually that didn’t work, the logs still appear but now for phoenix sockets and controllers.

[info] CONNECTED TO Phoenix.LiveView.Socket in 195µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Connect Info: %{}
  Parameters: %{"vsn" => "2.0.0"}

Line: 183
Function: "phoenix_socket_connected/4"
Module: Phoenix.Logger
Application: :phoenix
File: "lib/phoenix/logger.ex"
[info] Converted error Phoenix.Router.NoRouteError to 404 response

Line: 133
Function: "phoenix_error_rendered/4"
Module: Phoenix.Logger
Application: :phoenix
File: "lib/phoenix/logger.ex"

even though I have

use Phoenix.Controller, log: false

set in app_web.ex and

  socket "/live", Phoenix.LiveView.Socket, log: false

  socket "/socket", App.Web.UserSocket,
    websocket: true,
    longpoll: false,
    log: false

set in endpoint.ex.

Phoenix version 1.4.9


Seems like the log level option for "phoenix_error_rendered/4" comes from a module attribute, so my changes to config are unlike to change anything … Do I need to recompile the :phoenix dependency? Seems like I need to set log: false in for endpoint’s render_errors option. I wonder if I’m missing some obvious way to turn off all logs in phoenix. Or rather make them at :debug level.


Very strange, the function that logs "phoenix_error_rendered/4" doesn’t receive the log level (according to the gist below), but that would mean that it should use :debug level but uses :info instead as I see it logged.


Trace for socket connect log:

# Phoenix.Logger.phoenix_socket_connected(
[:phoenix, :socket_connected],
%{duration: 189593},
%{connect_info: %{}, endpoint: Web.Endpoint, log: :info, params: %{"vsn" => "2.0.0"}, result: :ok, serializer: Phoenix.Socket.V2.JSONSerializer, transport: :websocket, user_socket: Phoenix.LiveView.Socket, vsn: "2.0.0"}, 
:ok)

Log level is :info, even though it’s set to false in the endpoint …


Tried recompiling from scratch, still socket_connected gets logged. Giving up for today :slight_smile: Would need to find an easier way to do the logging, since in phoenix logs are neither purgeable at compile-time, nor settable at runtime … unless I’m holding it wrong.