Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :proc_lib.spawn(fn -> :erlang.error(:pang) end)
(it’s better to use a plain spawn than proc_lib:spawn in code like this, but this is an easy way to provoke a crash report - and this is how the code I was debugging was written. With a plain spawn, we get an error report instead of a crash report, and it’s displayed clearly in both Erlang and Elixir.)
Why does this happen?
Is this a bug or a feature? It seems to me like dropping error messages like this is incorrect, but perhaps I’m missing something.
Have you been able to find an answer? Enabling :handle_sasl_reports in Logger config helps, but my understanding on OTP-21+ is that error reports go directly to the logger without involving SASL, so I don’t get why the flag would be needed.
It’s a problem in dev because I need to choose between enabling the flag, which adds a ton of log spam due to SASL progress reports, or not enabling it, in which case processes die completely silently…
Edit: Perhaps it’s because Elixir calls the old :error_logger:
So the error reports go through SASL, unlike the Erlang ones, which use the new logger directly:
I can’t have any SASL reports in the console, is is very hard to understand why my whole application crashes when I kill some processes under load to see how the app would recover its state.
I have :sasl before :logger in extra applications (mix.exs), I have the both options (handle_sasl_reports and handle_otp_reports to true) in config/dev.exs … but nothing : no info when supervisors start, progress, or crash.
So, as the topic title says, there is no crash reports in the default configuration. But is there any configuration to write to have them back ?
runtime_tools is added by mix phx.new, and adding sasl is recommended by many sources I read. Also that as of erlang 21 handle_otp_reports must be set although true is the default (which makes no sens). But all of this is wrong actually (at least on my ex/erl versions), and you are right.
This works well then, if anyone else wants to keep custom console format:
As config will be automatically merged for 1 level.
as of erlang 21 handle_otp_reports must be set although true is the default
This is not true, you need only :handle_sasl_reports as handle_otp_reports: true is default (trust me, I have written Logger for Elixir 1.10+). The only thing is that :handle_sasl_reports will be ignored if :handle_otp_reports is false (which with current implementation is quite problematic, and IMHO setting handle_otp_reports: false should be deprecated).