Skip to content

Commit

Permalink
Change socket serializer/version logs to warning. (#5534)
Browse files Browse the repository at this point in the history
* Change socket serializer/version logs to warning.

Often times, random bots or scanners hit URLs with garbage params.
When this happens with a Phoenix socket URL, serializer negotiaiton can
fail and Phoenix will log this event.

Currently this happens at the `:error` level. In most cases, this is
not an error conditions, but an expected failure due to garbage in,
garbage out. As such, it's probably more appropriate for this to be
at the `:warning` level.
  • Loading branch information
aselder committed Aug 2, 2023
1 parent b0cbc54 commit a9cd1fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/phoenix/socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -555,13 +555,13 @@ defmodule Phoenix.Socket do
{:ok, serializer}

:error ->
Logger.error "The client's requested transport version \"#{vsn}\" " <>
Logger.warning "The client's requested transport version \"#{vsn}\" " <>
"does not match server's version requirements of #{inspect serializers}"
:error
end

:error ->
Logger.error "Client sent invalid transport version \"#{vsn}\""
Logger.warning "Client sent invalid transport version \"#{vsn}\""
:error
end
end
Expand Down Expand Up @@ -599,7 +599,7 @@ defmodule Phoenix.Socket do
{:ok, {state, %{socket | id: id}}}

invalid ->
Logger.error "#{inspect handler}.id/1 returned invalid identifier " <>
Logger.warning "#{inspect handler}.id/1 returned invalid identifier " <>
"#{inspect invalid}. Expected nil or a string."
:error
end
Expand Down

0 comments on commit a9cd1fd

Please sign in to comment.