﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>ana commented on How NOT to write a logger</title><description>I have seen this many times before, but on something like an error page,
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment19</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment19</guid><pubDate>Fri, 20 Mar 2009 20:44:41 GMT</pubDate></item><item><title>Paula commented on How NOT to write a logger</title><description>Brillant!
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment18</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment18</guid><pubDate>Fri, 20 Mar 2009 14:12:32 GMT</pubDate></item><item><title>Tool commented on How NOT to write a logger</title><description>If at first you don't succeed...
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment17</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment17</guid><pubDate>Fri, 20 Mar 2009 13:42:03 GMT</pubDate></item><item><title>miro commented on How NOT to write a logger</title><description>sfa
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment16</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment16</guid><pubDate>Fri, 20 Mar 2009 11:06:06 GMT</pubDate></item><item><title>Huseyin Tufekcilerli commented on How NOT to write a logger</title><description>This is what they call "dog fooding" :)
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment15</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment15</guid><pubDate>Fri, 20 Mar 2009 08:37:16 GMT</pubDate></item><item><title>Mr Berre commented on How NOT to write a logger</title><description>Ugh, reminds me of a bit of code I discovered recently in the web ui for a new project I was working on. All aspx pages inherit from a base class, which contains a check whether a user is allowed to even see anything in the UI. If a user wasn't allowed to, he was redirected to Error.aspx, which of course inherited from the base class and which of course triggered the check...
  
  
The UI code was based on another project's code (no need to re-invent the wheel) that has been in use for 6+ months. I'm still amazed that they've never had an issue with that, since usually the business people are very good at pointing people to apps they don't have access to.
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment14</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment14</guid><pubDate>Fri, 20 Mar 2009 01:26:37 GMT</pubDate></item><item><title>configurator commented on How NOT to write a logger</title><description>Reminds me of something similar that we have where I used to work:
  
  
void Save() {
  
    Recalculate();
  
    SaveToDatabase();
  
}
  
  
void Recalculate() {
  
    try {
  
        // some stuff
  
    } catch {
  
        Save();
  
    }
  
}
  
  
It's still there. "The "some stuff" shouldn't fail so why fix that part"
  
Of course, every once in a while someone makes a change and "some stuff" does fail, resulting in nasty bugs.
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment13</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment13</guid><pubDate>Fri, 20 Mar 2009 00:08:38 GMT</pubDate></item><item><title>Stefan commented on How NOT to write a logger</title><description>Heh I have seen this many times before, but on something like an error page, it would inherit the base page class which in on load would fail to connect to the DB and redirect to error page.
  
  
Endless redirect to error error error error, all the while sending error emails. That day I got 200,000 error emails from the site, fun fun fun.
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment12</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment12</guid><pubDate>Fri, 20 Mar 2009 00:07:55 GMT</pubDate></item><item><title>Jose commented on How NOT to write a logger</title><description>Maybe works fine for EventLogEntryType.Error.
  
  
is a joke
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment11</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment11</guid><pubDate>Thu, 19 Mar 2009 23:45:33 GMT</pubDate></item><item><title>Nick commented on How NOT to write a logger</title><description>While leads me to a question: What is the best way to log that your logger failed?
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment10</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment10</guid><pubDate>Thu, 19 Mar 2009 23:40:07 GMT</pubDate></item><item><title>Nair commented on How NOT to write a logger</title><description>I guess it is a joke right?
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment9</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment9</guid><pubDate>Thu, 19 Mar 2009 21:05:47 GMT</pubDate></item><item><title>Chris Smith commented on How NOT to write a logger</title><description>Genius.  Sheer genius.
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment8</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment8</guid><pubDate>Thu, 19 Mar 2009 20:16:34 GMT</pubDate></item><item><title>Maur&amp;#237;co commented on How NOT to write a logger</title><description>This might be the most brilliant try...catch block I have ever seen.
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment7</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment7</guid><pubDate>Thu, 19 Mar 2009 19:52:06 GMT</pubDate></item><item><title>configurator commented on How NOT to write a logger</title><description>Nice one.
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment6</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment6</guid><pubDate>Thu, 19 Mar 2009 19:11:29 GMT</pubDate></item><item><title>Dave commented on How NOT to write a logger</title><description>And than they say programmers don't have humor ;-)
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment5</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment5</guid><pubDate>Thu, 19 Mar 2009 19:00:42 GMT</pubDate></item><item><title>addy santo commented on How NOT to write a logger</title><description>down that path insanity lies :)
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment4</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment4</guid><pubDate>Thu, 19 Mar 2009 18:03:43 GMT</pubDate></item><item><title>Will Shaver commented on How NOT to write a logger</title><description>Ka-Booom!
  
  
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment3</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment3</guid><pubDate>Thu, 19 Mar 2009 18:01:39 GMT</pubDate></item><item><title>Joel commented on How NOT to write a logger</title><description>That *is* impressive.  I think that will lead to a StackOverflowException, right?  
  
  
According to the MSDN docs, calling EventLog.CreateEventSource or EventLog.WriteEntry with the source parameter set to an empty string ("") will generate an ArgumentException.  
  
  
Therefore, if during the first run through the function it throws an exception, the catch block will try and call into the Log function again (recursively) using a blank string, which will generate another exception, until a stack overflow occurs.
  
  
That's my guess. :)
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment2</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment2</guid><pubDate>Thu, 19 Mar 2009 17:53:46 GMT</pubDate></item><item><title>m4bwav commented on How NOT to write a logger</title><description>awesome, I almost missed the recursion
</description><link>http://ayende.com/3913/how-not-to-write-a-logger#comment1</link><guid>http://ayende.com/3913/how-not-to-write-a-logger#comment1</guid><pubDate>Thu, 19 Mar 2009 17:43:49 GMT</pubDate></item></channel></rss>