Elixir app crashing with unhelpful log messages

I have an Elixir app that I’ve been running for many years, and I deployed it to a new environment and it crashed with the following logs:

{"time":"2024-08-23 19:01:06.799","msg":"Running MyApp.Endpoint with cowboy 2.10.0 at :::8080 (http)","level":"info"}
{"time":"2024-08-23 19:01:06.800","msg":"Access MyApp.Endpoint at http://localhost","level":"info"}
{"time":"2024-08-23 19:01:06.890","msg":"Application my_app exited: shutdown","level":"notice"}
Kernel pid terminated (application_controller) ("{application_terminated,my_app,shutdown}")

The log messages show the the app shutdown, but doesn’t provide any information on why. It’d really like to see a stacktrace or an error report of some kind in the logs. In times past I’d use SASL to ensure I’d get crash reports, but with Erlang 26 I’m not sure what should be done. My config:

config :logger, :default_formatter,
  format: {ExJsonLogger, :format},
  metadata: [
    :action,
    :controller,
    :duration,
    :format,
    :method,
    :path,
    :query_string,
    :request_id,
    :status
  ]

config :logger, :default_handler, level: :info

Versions:

erlang 26.2
elixir 1.15.7-otp-26

This shows how to enable sasl logs: Logger — Logger v1.17.0

But on SASL Error Logging — sasl v4.2.2 I see it says

The SASL error logging concept described in this section is deprecated since Erlang/OTP 21.0, when the new logging API was introduced.

Is the Elixir Logger’s handle_sasl_reports not deprecated? I assumed it would be but is it not?

That deprecation means sasl messages are no longer managed as a separate system. The messages still exist as plain logs, which use the sasl domain. That domain is how elixir implements the optional filtering.

2 Likes