<story><title>Do Not Log</title><url>https://sobolevn.me/2020/03/do-not-log</url></story><parent_chain><item><author>marginalia_nu</author><text>I don&amp;#x27;t get why people get so theological about logging.&lt;p&gt;If logs bring you some sort of value, then log away. If they don&amp;#x27;t, then don&amp;#x27;t. In some domains you absolutely crucially need logs, in others they&amp;#x27;re largely a waste of time.&lt;p&gt;Logging is probably the most foolproof way to extract debugging information from your application. The killer feature of logging is that standard out very rarely breaks, no matter how bad things get it works. It will work from the moment the application starts, it will work in an OOM situation, will work if your network switch is on fire, when the DNS records are wrong and your technicians can&amp;#x27;t even enter the building, it will work no matter how bad things are. If logging does somehow fail, then that is on you, in that scenario you have fucked up your architecture somehow.</text></item></parent_chain><comment><author>geocar</author><text>&amp;gt;  I don&amp;#x27;t get why people get so theological about logging.&lt;p&gt;Because the reason to log is about people, not about technology.&lt;p&gt;There&amp;#x27;s no technical reason to make logs: Just don&amp;#x27;t make bugs, and you won&amp;#x27;t need the logs to find out what went wrong because nothing will have gone wrong. Go to the beach!&lt;p&gt;This is hard though, and bugs happen for all sorts of reason that have nothing to do with the programmer making a mistake-- the customer can be unsatisfied because they didn&amp;#x27;t know what they wanted. Programmers learn &lt;i&gt;very early in their career&lt;/i&gt; to distrust the requirements, because they know that saying &lt;i&gt;but that&amp;#x27;s what the ticket says&lt;/i&gt; gets them nowhere besides an argument: They have to do what the business&amp;#x2F;customer &lt;i&gt;meant&lt;/i&gt;.&lt;p&gt;Put another way, the &lt;i&gt;user&lt;/i&gt; doesn&amp;#x27;t want logs: The user wants to know if everything is okay or not, and &lt;i&gt;presumably&lt;/i&gt; they have some way to figure that out, but if it isn&amp;#x27;t working correctly (or they merely think it isn&amp;#x27;t), the programmer will probably want those logs to help them.&lt;p&gt;In many environments, the loop is larger than just those two people, there&amp;#x27;s QA support people, and internal experts&amp;#x2F;operators, and triage, and &lt;i&gt;all of those people&lt;/i&gt; are going to have different needs from those logfiles. People might also have a second use for those logs involving anticipation of failures and tracking capacity.&lt;p&gt;So there are a lot of non-technical, non-functional needs for logs, and once you understand this, it may be a little easier to understand why people would have almost &lt;i&gt;rabid opinions&lt;/i&gt; about what those logs should look like (or if they can get the cure they need another way, what they might prefer &lt;i&gt;instead&lt;/i&gt; of logs)&lt;p&gt;&amp;gt; [standard out] will work in an OOM situation&lt;p&gt;If you use write() which doesn&amp;#x27;t allocate memory, that&amp;#x27;s almost true, but if you use printf() it might allocate memory, and it might not work in an OOM anyway depending on what &amp;quot;standard out&amp;quot; actually &lt;i&gt;is&lt;/i&gt;.&lt;p&gt;&amp;gt; will work if your network switch is on fire, when the DNS records are wrong and your technicians can&amp;#x27;t even enter the building&lt;p&gt;And yes you can write logs that nobody will ever be able to read, &lt;i&gt;but what&amp;#x27;s the point of that?&lt;/i&gt; When your manufacturing plant is a smoldering rubble, someone is going to want to launch an expedition for those hard drives and try and figure out what caused millions (or potentially billions) of dollars in damages, so if you just wrote everything to standard output and washed your hands of the rest, you might have to find another job anyway.&lt;p&gt;I&amp;#x27;ve been programming for over three decades at this point, and I&amp;#x27;m convinced there is no &amp;quot;easy one-size-fits-all answer&amp;quot; to whether to log or not, or if to log, &lt;i&gt;how&lt;/i&gt; to log, so I find it useful to learn about this bit of theology so that I&amp;#x27;m better equipped to talk to others about this, and maybe convince them of my opinions.</text></comment>
<story><title>Do Not Log</title><url>https://sobolevn.me/2020/03/do-not-log</url></story><parent_chain><item><author>marginalia_nu</author><text>I don&amp;#x27;t get why people get so theological about logging.&lt;p&gt;If logs bring you some sort of value, then log away. If they don&amp;#x27;t, then don&amp;#x27;t. In some domains you absolutely crucially need logs, in others they&amp;#x27;re largely a waste of time.&lt;p&gt;Logging is probably the most foolproof way to extract debugging information from your application. The killer feature of logging is that standard out very rarely breaks, no matter how bad things get it works. It will work from the moment the application starts, it will work in an OOM situation, will work if your network switch is on fire, when the DNS records are wrong and your technicians can&amp;#x27;t even enter the building, it will work no matter how bad things are. If logging does somehow fail, then that is on you, in that scenario you have fucked up your architecture somehow.</text></item></parent_chain><comment><author>waffletower</author><text>Definite up vote here. Theological is the perfect word for this.  It would be helpful if the author substituted the word &amp;quot;blog&amp;quot; for the word &amp;quot;log&amp;quot; in the article, and took the new meanings that result seriously.</text></comment>