axelclark

axelclark

No logs in production from GenServer init function

I’m running a Phoenix app on Fly. I have a GenServer I’m starting as a child in my Application.start/2 function under my MyApp.Supervisor.

I had it crash within the GenServer.init/1 function when the app was starting for a deploy. In the logs there was:

{exit,terminating,[{application_controller,call,2,[{file,"application_controller.erl"},{line,511}]},{application,enqueue_or_start,6,[{file,"application.erl"},{line,380}]},{application,ensure_all_started,3,[{file,"application.erl"},{line,359}]},{elixir,start_cli,0,[{file,"src/elixir.erl"},{line,195}]},{init,start_it,1,[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}
Runtime terminating during boot (terminating)

However, the cause of the crash was not in the logs. When I tested it more, if I try to log in GenServer.init/1 during a successful start with Logger.error("Test log") it also doesn’t end up in the production logs.

The crash and logs show up when I try all these scenarios in dev using either mix or a release.

I found How do I get Phoenix or Elixir to print more detailed logs on a crash? and added:

config :logger, 
   handle_otp_reports: true, 
   handle_sasl_reports: true,
   ...

That gave me more information about the supervisor starting its children, but I still didn’t get any logs from the GenServer init function in production.

My config/prod.exs is:

config :logger,
  level: :info,
  backends: [:console, {Appsignal.Logger.Backend, [group: "phoenix"]}],
  handle_otp_reports: true,
  handle_sasl_reports: true

my config/config.exs is:

config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

Any idea why I’m not getting these logs in production (either AppSignal or the console)?

Marked As Solved

martosaur

martosaur

Alright, I think you’ve encountered this bug that was fixed in Erlang 27.2.1 Missing error logs when application crashes on OTP-26 · Issue #9163 · erlang/otp · GitHub

Last Post!

axelclark

axelclark

Amazing! Thank you!

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement