elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.52k stars 3.38k forks source link

Cowboy no longer logging when updating from Elixir 1.14.4 to 1.15.4 #12879

Closed barttenbrinke closed 1 year ago

barttenbrinke commented 1 year ago

Elixir and Erlang/OTP versions

elixir --version Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [jit:ns]

Elixir 1.15.4 (compiled with Erlang/OTP 24)

erl --version Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [jit:ns]

Eshell V14.0.2 (press Ctrl+G to abort, type help(). for help)

Operating system

Ubuntu focal 20.04

Current behavior

iex -S mix phx.server
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.4) - press Ctrl+C to exit (type h() ENTER for help)
vite v4.4.9 building for development...
webpack 5.88.2 compiled with 6 warnings in 5683 ms
iex(1)> 

Any requests done to any of the 3 endpoints does not result in any logging being written to console / stdout.

Dependencies:

Dependencies:
  amqp 2.1.2
  amqp_client 3.8.35
  bankster 0.3.3
  cachex 3.6.0
  castore 0.1.22
  certifi 2.9.0
  combine 0.10.0
  cowboy 2.10.0
  cowboy_telemetry 0.4.0
  cowlib 2.12.1
  credentials_obfuscation 3.1.0
  crontab 1.1.13
  crypto_rand 1.0.3
  csv 3.0.5
  cupido 4.1.1
  cupido_dev 2.0.3
  db_connection 2.5.0
  decimal 2.1.1
  dialyxir 1.3.0
  dogmatix 0.1.0
  earmark 1.4.39
  earmark_parser 1.4.33
  ecto 3.10.3
  ecto_sql 3.10.1
  elixir_uuid 1.2.1
  elixlsx 0.5.1
  email_checker 0.2.4
  erlex 0.2.6
  erlsom 1.5.1
  eternal 1.2.2
  ex2ms 1.6.1
  ex_doc 0.30.5
  ex_json_logger 1.2.0
  ex_rated 2.1.0
  exactor 2.2.4
  exjsx 4.0.0
  expo 0.4.1
  exq 0.19.0
  exq_ui 0.13.0
  exvcr 0.14.3
  faker 0.17.0
  file_system 0.2.10
  floki 0.34.3
  gen_stage 1.2.1
  gettext 0.23.0
  goldrush 0.1.9
  hackney 1.18.1
  httpoison 2.1.0
  iconv 1.0.13
  idna 6.1.1
  inflex 2.1.0
  iteraptor 1.14.0
  jason 1.4.1
  jsx 3.1.0
  jumper 1.0.1
  junit_formatter 3.3.1
  lager 3.9.2
  makeup 1.1.0
  makeup_elixir 0.16.1
  makeup_erlang 0.1.2
  meck 0.9.2
  metrics 1.0.1
  mime 2.0.5
  mimerl 1.2.0
  msgpax 2.4.0
  myxql 0.6.3
  neotoma 1.7.3
  nimble_options 1.0.2
  nimble_parsec 1.3.1
  number 1.0.4
  open_api_spex 3.17.3
  optimal 0.3.6
  opus 0.8.4
  parse_trans 3.3.1
  phoenix 1.7.7
  phoenix_ecto 4.4.2
  phoenix_html 3.3.2
  phoenix_live_dashboard 0.7.2
  phoenix_live_reload 1.4.1
  phoenix_live_view 0.18.18
  phoenix_pubsub 2.1.3
  phoenix_pubsub_redis 3.0.1
  phoenix_template 1.0.3
  phoenix_view 2.0.2
  plug 1.14.2
  plug_cowboy 2.6.1
  plug_crypto 1.2.5
  poolboy 1.5.2
  quantum 3.5.0
  rabbit_common 3.8.35
  ranch 1.8.0
  recon 2.5.1
  redix 1.2.3
  remote_ip 1.1.0
  retry 0.18.0
  rollbax 0.11.0
  saxy 1.5.0
  scrivener 2.7.2
  scrivener_ecto 2.7.0
  scrivener_list 2.0.1
  secure_compare 0.1.0
  sleeplocks 1.1.2
  spandex 3.2.0
  spandex_datadog 1.3.0
  spandex_ecto 0.7.0
  spandex_phoenix 1.1.0
  ssl_verify_fun 1.1.7
  sweet_xml 0.7.3
  telemetry 1.2.1
  telemetry_metrics 0.6.1
  telemetry_poller 1.0.0
  telemetry_registry 0.3.1
  tesla 1.4.4
  tesla_cacher 0.4.0
  timex 3.7.11
  tzdata 1.1.1
  unicode_util_compat 0.7.0
  unsafe 1.0.1
  websock 0.5.2
  websock_adapter 0.5.3
  xlsxir 1.6.4
  xml_builder 0.0.9
  yamerl 0.10.0
  yaml_elixir 2.9.0

Expected behavior

iex -S mix phx.server
[info] Access Signup.Endpoint at http://localhost:4003
[info] Running Admin.Endpoint with cowboy 2.10.0 at 0.0.0.0:4002 (http)
[info] Access Admin.Endpoint at http://localhost:4002
Interactive Elixir (1.14.4) - press Ctrl+C to exit (type h() ENTER for help)

vite v4.4.9 building for development...

webpack 5.88.2 compiled with 6 warnings in 5764 ms
[info] GET /
[debug] Processing with Admin.DashboardLive.index/2
  Parameters: %{}
  Pipelines: [:browser, :admin_basic_auth]
[debug] Phoenix.Router halted in :admin_basic_auth/2
iex(1)> 
barttenbrinke commented 1 year ago

When I generate a new Umbrella app for OTP 26 / Elixir 1.15.4 it DOES log to the console, so I assume there is some config difference, but I've made sure the dependencies are identical and I looked at practically everything.. also the upgrade guide says it should "just work"?

josevalim commented 1 year ago

Take a look at config files. If still fails, please provide a way to reproduce :)

barttenbrinke commented 1 year ago

Well two people have been working on this for two days now :) We've made sure:

Do yo have any idea where we can look in order to reproduce this :)?

Code reloader exceptions and asset pipeline DO log, so it is only Cowbow and Live requests that are not logged.

** (RuntimeError) could not compile application:
You must restart your server after changing the following files:
  * /config/config.exs
josevalim commented 1 year ago

Nothing from the top of my head :(

wpiekutowski commented 1 year ago

Switching to the legacy backend solved the problem. The project this is happening in has lots of deps and I wasn't able to pinpoint what causes the problem. One dep stands out and is directly related to logging: https://hex.pm/packages/lager, but I wasn't able to remove it from the project to verify this assumption.

This doc helped: https://hexdocs.pm/logger/1.15/Logger.html#module-backends-and-backwards-compatibility.

# mix.exs

def deps do
  [
   #...
    {:logger_backends, "~> 1.0"}
  ]
end
# config.exs

config :logger, backends: [LoggerBackends.Console]
config :logger, LoggerBackends.Console, []
josevalim commented 1 year ago

Closing this for now. If there is a mechanism to reproduce the failure, we will gladly reopen! :)