I was able to resolve/prevent all of these errors (and some new ones that appeared after the first set were resolved).
I removed the backend from the :applications key – that was good to do anyways. I’m going to try to cleanup the dependencies more generally later, e.g. remove the :applications key entirely and add only the necessary ‘extra’ apps to the :extra_applications key. (My app is older than those changes in Elixir; hence the stale state of this code/configuration.)
I modified my Logger configuration to NOT include this backend. Instead, I added a ‘start phase’ for the application; in mix.exs:
# Start `logger_logstash_backend` after `timex` (and `tzdata`) have been started:
start_phases: [{:logger_logstash_backend, []}]
and in my main app module:
def start_phase(:logger_logstash_backend, _start_type, _phase_args) do
IO.puts "Starting application start phase `:logger_logstash_backend`"
case Application.fetch_env(:my_app, :logger_logstash_backend) do
:error ->
IO.puts "No configuration value was found for the Logger Logstash backend."
{:ok, options} ->
backend = {LoggerLogstashBackend, :logstash_log}
# From the docs for `Logger.add_backend`:
#
# > Backends added by this function are not persisted. Therefore
# > if the Logger application or supervision tree is restarted,
# > the backend won't be available. If you need this guarantee,
# > then configure the backend via the application environment.
#
# This shouldn't be an issue for us as the `Logger` application and supervision tree don't seem
# to have ever needed to be restarted; just started normally when the app is started, i.e. when
# running the app locally in a `:dev` environment or when starting a new instance in production.
Logger.add_backend(backend)
Logger.configure_backend(backend, options)
end
:ok
end






















