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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dimitarvp" data-post="11" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>I will be grateful to be enlightened though.</p>
</blockquote>
</aside>
<p>In short, since not really a topic for it, systemd prefers all main-system-related parts of a system to know about each other and talk via API’s, unlike the sysinitV old model that uses text to talk.  This even shows in their logging systems where sysinitV is just text files, and journald (systemd’s logging system) is a structured logging system, quite literally a time based database, which by default on most (well, all that I’ve seen) distribution will write out a copy to the sysinitV’s text file locations in textual format for backwards compat, but that is entirely optional and not something you need unless you have things that read old sysinitV’s logging data.  Consequently doing a query/search/lookup/whatever over the logs in the system is <em>significantly</em> faster than via plain text files and you can get far more accurate results.</p>
<p>The thing that causes the systemd vs sysinitV in the linux community is that people “Don’t like monolithic tools” as it goes against the unix model.  The thing is that by the tools being so tightly bound together means that they can become significantly more efficient, which is why systemd is just outright <em>faster</em> than sysinitV models (like it is inherently parallel in hardware init, even communication pipes between programs are init’d “immediately” even before the dependencies are fully loaded yet then paused until loaded when access is performed, etc… etc… etc…, which are a lot of things the sysinitV model just cannot do).  Plus the fact it’s not Text based but rather is binary (and I say those people don’t know how UNIX systems traditionally worked…).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="129998" data-batch-url="/posts/batch_likers">
                        3
                      </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/future-of-logger-in-elixir/22581/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-129998" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="129998"
                     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="130001" data-post-id="130001">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>In that case you are spot on. I do like <code>systemd</code> more!</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="12" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>people “Don’t like monolithic tools” as it goes against the unix model. The thing is that by the tools being so tightly bound together means that they can become significantly more efficient</p>
</blockquote>
</aside>
<p>This! The UNIX philosophy is being exaggerated in many places and that’s not OK. We are hitting hardware limits that won’t be bumped for years and we have to start getting very conservative and practical about the cost of decoupling stuff religiously. Sure it helps conceptually but having everything in a mono-repo for your project would be even better – caching, monitoring, logging, hell, even your DB and storage should be integrated right into your project! And even your OS. (Hello Nerves and Erlang hardware, I love you!)</p>
<p>I don’t deny that Postgres, Redis and many others are top-notch marvels of engineering we often can’t do without. But IMO it’s time we start some sort of a tech convergence or else 2-3 Electron apps can still clog a perfectly cooled i9 CPU.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130001" data-batch-url="/posts/batch_likers">
                        1
                      </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/future-of-logger-in-elixir/22581/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-130001" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130001"
                     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 #12"></div>
  </section>
</div>
    <div class="postbit" id="130064" data-post-id="130064">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chulkilee" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/120/6207_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chulkilee
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think the current logger “interface” is good enough - which can take any data as metadata. telemtry is different thing.</p>
<p>What’s missing for me is good logging formatter and configuration convention across different applications, so that you don’t hit strange issues (… like a library passes custom struct to metadata, and Jason refuses to encode it to JSON)</p>
<p>To reuse my convention.. I wrote following small packages to print out metadata in one-line JSON</p>
<ul>
<li><a href="https://hex.pm/packages/metadata_logger_json_formatter" class="inline-onebox" rel="nofollow">metadata_logger_json_formatter | Hex</a></li>
<li><a href="https://hex.pm/packages/plug_metadata_logger" class="inline-onebox" rel="nofollow">plug_metadata_logger | Hex</a></li>
<li><a href="https://hex.pm/packages/tesla_metadata_logger" class="inline-onebox" rel="nofollow">tesla_metadata_logger | Hex</a></li>
</ul>
<p>In my case, I’m using just console backend, as apps are running in k8s and log aggregation is done by integrated ELK. However, some may prefer to have logger backend directly integrated with other log collection systems.</p>
<p>A while ago <a class="mention" href="/u/pragdave" rel="nofollow">@pragdave</a> created <a href="https://hex.pm/packages/bunyan" class="inline-onebox" rel="nofollow">bunyan | Hex</a> for such framework. Not sure about other options.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130064" 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/future-of-logger-in-elixir/22581/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-130064" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130064"
                     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 #13"></div>
  </section>
</div>
    <div class="postbit" id="130066" data-post-id="130066">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <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">
								<aside class="quote no-group" data-username="chulkilee" data-post="14" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>I think the current logger “interface” is good enough</p>
</blockquote>
</aside>
<p>Unfortunately it is lagging behind Erlang’s <code>logger</code> API which provides structured logging.</p>
<aside class="quote no-group" data-username="chulkilee" data-post="14" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>telemtry is different thing.</p>
</blockquote>
</aside>
<p>Not that different. <code>telemetry</code> is just additional logging library that is meant to log only metrics, but <a href="https://grafana.com/blog/2016/01/05/logs-and-metrics-and-graphs-oh-my/" rel="noopener nofollow ugc">these two are interconnected</a>. So for me there is not that much difference between <code>logger</code>’s structured logging feature and <code>telemetry</code>.</p>
<p>And <code>metadata</code> field in log entry is completely different from actual log entry. For example request duration belongs to log main value, not its metadata. And in structured logging you can make explicit distinction which is what.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="10" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Sounds like you are a fan of systemd instead of sysinitv then? ^.^</p>
</blockquote>
</aside>
<p>Structured logging still can be achieved with textual format, these two features are orthogonal. Just using some kind of TSDB helps with querying such data.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130066" 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/future-of-logger-in-elixir/22581/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-130066" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130066"
                     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 #14"></div>
  </section>
</div>
    <div class="postbit" id="130070" data-post-id="130070">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chulkilee" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/120/6207_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chulkilee
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="hauleth" data-post="15" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/48/18942_2.png" class="avatar"> hauleth:</div>
<blockquote>
<p>Unfortunately it is lagging behind Erlang’s <code>logger</code> API which provides structured logging.</p>
</blockquote>
</aside>
<p>I see Elixir Logger expects chardata while Erlang logger can accept a map <a href="http://erlang.org/doc/man/logger.html#type-report" rel="nofollow">src</a>.</p>
<p>This can be improved in future version of Elixir requiring OTP &gt; 21, <em>without</em> breaking interface, instead of taking <code>chardata_or_fun</code> type. This is actually in <a href="https://github.com/elixir-lang/elixir/issues/6611" class="inline-onebox" rel="noopener nofollow ugc">Support Erlang 21 new features · Issue #6611 · elixir-lang/elixir · GitHub</a> - “Unify <code>:logger</code> and <code>Logger</code> metadata”</p>
<aside class="quote no-group" data-username="hauleth" data-post="15" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/48/18942_2.png" class="avatar"> hauleth:</div>
<blockquote>
<p>And <code>metadata</code> field in log entry is completely different from actual log entry. For example request duration belongs to log main value, not its metadata. And in structured logging you can make explicit distinction which is what.</p>
</blockquote>
</aside>
<p>I see your point, but why not using metadata as your “additional data” attached to keep the data? And actually there are good feature of Logger metadata - living in a process - so you can just set persistent “main log value” in metadata, and keep using it. Do we need to reinvent this behavior? Maybe. But why don’t we leverage existing metadata?</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Logger.metadata(transaction_id: txid)
Logger.debug("starting", foo: 1, bar: 2)
# ....
Logger.info("completed")
</code></pre>
<p>If we want side-effect free logging… then we need to pass everything. That works, but I don’t think it worths to do that. We set Logger metadata explicilty for logger (e.g. not “misusing” process dictionary… oh I’m <a href="https://forum.elixirforum.com/t/is-it-a-good-idea-to-store-context-in-process-dictionary-registry-for-http-requests/3142/4" rel="nofollow">breaking the rule #1</a>)</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">log_common_metadata = [transaction_id: txid]
Logger.debug([message: "starting", foo: 1, bar: 2] ++ log_common_metadata)
Logger.info([{:message, "completed"} | log_common_metadata)
</code></pre>
<aside class="quote no-group quote-modified" data-username="hauleth" data-post="15" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/48/18942_2.png" class="avatar"> hauleth:</div>
<blockquote>
<p>Not that different. <code>telemetry</code> is just additional logging library that is meant to log only metrics, but <a href="https://grafana.com/blog/2016/01/05/logs-and-metrics-and-graphs-oh-my/" rel="noopener nofollow ugc">these two are interconnected</a>. So for me there is not that much difference between <code>logger</code> 's structured logging feature and <code>telemetry</code> .</p>
</blockquote>
</aside>
<p>Logging and collecting metric has some common goals, but logger and telemtry is different mechanism. logger creates log events on caller side while telemtry implements dispatching mechanism to allow <em>others</em> know when a specific event happens. The can serve the same purpose - by using telemtry to trigger events (via <code>:telemetry.execute/3</code>) for any events requiring logs, and writing telemtry handler to subscribe those events, and just “print log message”. It works, and I see there are certain cases it’s better to use define telemtry events. Oh, we may define a event called “logevent” and then log backend subscribing those events. Oh, then we basically use telemtry as message queue <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130070" 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/future-of-logger-in-elixir/22581/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-130070" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130070"
                     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 #15"></div>
  </section>
</div>
    <div class="postbit" id="130071" data-post-id="130071">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <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">
								<aside class="quote no-group" data-username="chulkilee" data-post="16" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>“Unify <code>:logger</code> and <code>Logger</code> metadata”</p>
</blockquote>
</aside>
<p>This is not exactly that. The unification there is meant that  when you call <code>:logger.set_process_metadata/1</code> it will also affect <code>Logger.metadata/0</code> return value, so utilities like OpenCensus do not need separate wrapper to handle both logging libraries. It isn’t at all about structured logging as this would be a breaking change for formatter and/or backends.</p>
<aside class="quote no-group" data-username="chulkilee" data-post="16" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>why not using metadata as your “additional data”</p>
</blockquote>
</aside>
<p>This is the whole point. The metadata should be only “additional data” that give you context about log entry, it should not contain log data like request duration, as this belongs to the log entry itself.</p>
<p>Example of difference between structured logging and “classical” approach:</p>
<p>In <code>Plug.Logger</code> right now we have (on abstract level):</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">duration = measure_duration(call_next_plugs())

Logger.info("Respond #{conn.resp_code} on #{conn.path} in #{duration}", request_id: req_id)
</code></pre>
<p>While structured log will be like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">duration = measure_duration(call_next_plugs())

Logger.info(%{resp_code: conn.resp_code, req_path: conn.path, req_duration: duration}, request_id: req_id)
</code></pre>
<p>So you see that log entry contain “core” values of the log and metadata is for, well, metadata.</p>
<aside class="quote no-group" data-username="chulkilee" data-post="16" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>logger and telemtry is different mechanism</p>
</blockquote>
</aside>
<p>Not much to be honest. Both of these are just dispatch of some data to different backends. The differences are even less distinct in case of Erlang’s <code>logger</code> and <code>telemetry</code>. The only difference in fact is that <code>logger</code> also pass the data through <code>formatter</code>.</p>
<aside class="quote no-group" data-username="chulkilee" data-post="16" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>Oh, then we basically use telemtry as message queue</p>
</blockquote>
</aside>
<p>All <code>telemetry</code>, <code>Logger</code>, and <code>logger</code> are basically message queues.</p>
<p>The main problem is that with <code>logger</code> replacing <code>telemetry</code> and broader usage of structured logging it will be easier to implement white-box telemetry in BEAM core rather than adding new library to default release. Especially as <code>logger</code> is in <code>kernel</code> application so it is <strong>always</strong> up and running in <strong>all</strong> Erlang applications running OTP 21+ as this is application that is (almost?) impossible to not run.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130071" 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/future-of-logger-in-elixir/22581/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-130071" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130071"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="130082" data-post-id="130082">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chulkilee" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/120/6207_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chulkilee
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think we’re on the same page that we need more “structured logging”. Don’t get me wrong - I’ve achieve that using metadata. see my code at <a href="https://github.com/chulkilee/plug_metadata_logger/blob/v0.1.0/lib/plug_metadata_logger.ex" class="inline-onebox" rel="noopener nofollow ugc">metadata_logger_plug/lib/plug_metadata_logger.ex at v0.1.0 · elixir-metadata-logger/metadata_logger_plug · GitHub</a></p>
<p>From developer point of view, it <strong>doesn’t matter</strong> how logger and telemetry are implemented in similar way or not. I just need structured logging, and I could do that with metadata and custom formatter.</p>
<p>What I don’t understand from your comments are: what problem you’re trying to solve?</p>
<ul>
<li>Logging is for application itself, and log message is not generally expected to be consumed by other erlang applications.</li>
<li>Telemetry is for (new) common interface for instrumentation, which allows others to instrument you - so events are expected to be consumed by others.</li>
</ul>
<p>They’re for different purpose, so “interface to user” should be different. Even they are implemented with shared app, it doesn’t make sense to “consolidate” Logging interface into telemetry, or vice versa.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130082" 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/future-of-logger-in-elixir/22581/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-130082" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130082"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="130205" data-post-id="130205">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="hauleth" data-post="15" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/48/18942_2.png" class="avatar"> hauleth:</div>
<blockquote>
<p>Structured logging still can be achieved with textual format, these two features are orthogonal. Just using some kind of TSDB helps with querying such data.</p>
</blockquote>
</aside>
<p>That’s what json is after all, just structured text.  I was referencing their ecosystem designs though.  ^.^</p>
<aside class="quote no-group" data-username="chulkilee" data-post="16" data-topic="22581">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>I see Elixir Logger expects chardata while Erlang logger can accept a map <a href="http://erlang.org/doc/man/logger.html#type-report" rel="nofollow">src</a>.</p>
</blockquote>
</aside>
<p>Ooo really?  I really need to read up on erlang’s new logger already…  &gt;.&gt;</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130205" 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/future-of-logger-in-elixir/22581/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-130205" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130205"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="340003" data-post-id="340003">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="PJUllrich" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/PJUllrich/120/15944_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  PJUllrich
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Building Table Views with Phoenix LiveView</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hey folks, I’d like to resurrect this old thread because it seems that the <code>Logger</code> vs <code>:logger</code> deprecation is entering its next phase with the deprecation of <a href="https://github.com/elixir-lang/elixir/blob/47abe2d107e654ccede845356773bcf6e11ef7cb/lib/logger/lib/logger.ex#L833" rel="noopener nofollow ugc">Logger.add_backend/2</a> and the extraction of most of the <code>Logger</code> logic into the external <a href="https://github.com/elixir-lang/logger_backends" rel="noopener nofollow ugc">LoggerBackends</a> library.</p>
<p>I had an interesting discussion with <a class="mention" href="/u/lostkobrakai" rel="nofollow">@LostKobrakai</a> on <a href="https://x.com/lostkobrakai/status/1835641991058600153" rel="noopener nofollow ugc">Twitter</a>, and it sounds like some or most of the <code>Logger</code> module will be deprecated in favor of the <code>:logger</code> module, especially when it comes to adding custom logging backends.</p>
<p>Now, I tried to rewrite a custom Logger Backend <a href="https://github.com/PJUllrich/run-elixir/blob/main/assets/archived_code/old_file_logger.ex" rel="noopener nofollow ugc">here</a> to the new <code>:logger</code> module (draft code <a href="https://github.com/PJUllrich/run-elixir/blob/main/assets/archived_code/file_logger.ex" rel="noopener nofollow ugc">here</a>) but struggled at many points.</p>
<p>One example is converting the <code>format</code> option from the <code>Logger.Formatter</code> to the <code>template</code> option of the <code>:logger_formatter</code>. I have this <code>Logger</code> option: <code>format: "$date $time [$level] $message\n"</code></p>
<p>For the <code>:logger_formatter</code>, it seems that you have to define the new <code>template</code> option as a list of atoms and strings. So, I tried <code>[:date, " ", :time, " [", :level, "] ", :msg, "\n"]</code> and that kind of worked, but the <code>log_event</code> you receive in the <code>log/2</code> callback of the <code>:logger</code> handler doesn’t have the same fields and metadata as the <code>event</code> of the Logger. For example, it doesn’t have the <code>:date</code> part, but only a unix time.</p>
<p>I mean, I could convert these fields myself, but my question is rather: <strong>What’s the migration plan here?</strong></p>
<p>How will the migration from <code>Logger</code> to <code>:logger</code> look like? What will stay in <code>Logger</code> and what will move to <code>:logger</code>? Will Elixir support the old format strings also from Elixir 1.19 onwards (that’s when e.g. <code>Logger.add_backend/2</code> will be deleted) or will we have to rewrite all these <code>Logger</code> options to the new <code>:logger</code> configuration?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340003" 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/future-of-logger-in-elixir/22581/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-340003" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340003"
                     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 #19"></div>
  </section>
</div>
    <div class="postbit" id="340005" data-post-id="340005">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="LostKobrakai" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/LostKobrakai/120/3072_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  LostKobrakai
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I don’t think the expectation is that existing logger backends are translated to :logger handlers. That’s exactly what the LoggerBackends library is there for – that you don’t need to do that.</p>
<p>You want to look at :logger handlers for any new stuff however, because it’s available OTP wide (not limited to elixir) and the primary documented path based on elixirs docs as well.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340005" 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/future-of-logger-in-elixir/22581/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-340005" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340005"
                     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 #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/22581/load_more?page=3">Load more posts (3 remaining)</a>
</div></template></turbo-stream>