<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="157676" data-post-id="157676">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kenny-evitt" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kenny-evitt
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for the feedback!</p>
<p>Where should I put <code>Application.ensure_all_started(:timex)</code>?</p>
<p>The logging that seems to be failing isn’t anything explicitly in my application’s code; it’s various dependencies AFAICT.</p>
<p>I’m going to try removing the <code>:applications</code> key entirely and then adding any applications not automatically inferred by Elixir to the <code>:extra_applications</code> key as you and others have suggested.</p>
<p>I just discovered that <code>Logger</code> backends <em>can</em> be dynamically configured via <code>Logger.add_backend/2</code>. I also want to try removing this backend from the <code>Logger</code> config data and calling that function in a separate <code>start_phase</code> function, and possibly explicitly check that the <code>tzdata</code> ETS table(s) are ready and accessible before doing so.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157676" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/resolving-errors-for-logger-backend-on-application-start/28069/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-157676" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157676"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="157982" data-post-id="157982">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kenny-evitt" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kenny-evitt
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I was able to resolve/prevent all of these errors (and some new ones that appeared after the first set were resolved).</p>
<p>I removed the backend from the <code>:applications</code> key – that was good to do anyways. I’m going to try to cleanup the dependencies more generally later, e.g. remove the <code>:applications</code> key entirely and add only the necessary ‘extra’ apps to the <code>:extra_applications</code> key. (My app is older than those changes in Elixir; hence the stale state of this code/configuration.)</p>
<p>I modified my <code>Logger</code> configuration to NOT include this backend. Instead, I added a ‘start phase’ for the application; in <code>mix.exs</code>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">       # Start `logger_logstash_backend` after `timex` (and `tzdata`) have been started:
       start_phases: [{:logger_logstash_backend, []}]
</code></pre>
<p>and in my main app module:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  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 -&gt;
        IO.puts "No configuration value was found for the Logger Logstash backend."

      {:ok, options} -&gt;
        backend = {LoggerLogstashBackend, :logstash_log}

        # From the docs for `Logger.add_backend`:
        #
        # &gt; Backends added by this function are not persisted. Therefore
        # &gt; if the Logger application or supervision tree is restarted,
        # &gt; the backend won't be available. If you need this guarantee,
        # &gt; 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
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="157982" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/resolving-errors-for-logger-backend-on-application-start/28069/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-157982" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="157982"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-solved cat-solved" title="Marked as solution"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>