How to show stacktrace in logs in Phoenix production app?

Hi, I deployed my app to production using distillery, when I check the log var/log/erlang.log.1, only able to see

04:03:29.504 request_id=FhDvUq-23VwxBVkAAAHh [info] Sent 500 in 2626ms

Is there a way to show error stacktrace?

You could try enabling handle_sasl_reports in your Logger config:

https://bgmarx.com/2019/02/02/gaining-insight-with-sasl/

https://hexdocs.pm/logger/Logger.html#module-erlang-otp-integration

@dom Thanks. I tried enable handle_sasl_reports, but no luck, no stacktrace showed in logs.

I think this option isn’t useful for OTP > 21, see https://erlang.org/doc/apps/sasl/error_logging.html. I’m using OTP 23 for production. After OTP 21, the crash reports are issued as error level log events, and are logged through the default handler started by Kernel, which means they’ll be logged as error.