log4net is driving me crazy, and doing so in a souped-up Ferrari in 5th gear. Admittedly, it’s a short distance from “where I am now” to “crazy”, but I don’t want some idiotic software program to push me over the line.
The latest travesty came yesterday, when I spent way too much time diagnosing why log4net wasn’t outputting anything to the log(s). Not only that, but there were no Event Viewer entries. So I tried dinking around with the usual culprits – verifying paths, permissions, triple-checking the log4net.config file entries against known-good examples, yadda yadda yadda.
Finally I realized that my build process was not pulling over .asax files to the deploy directory. You might remember .asax as the file in ASP.NET projects that is tied to with the Global application code-behind class. My build process (MSBuild-based, very cool, customizations up the yang) has a whitelist of acceptable file extensions to pull over, and .asax was missing.
So I added it. And the goddamned log4net system started spitting out log messages. FUCK!
<flame><on>
OK, first of all, if you’re so goddamned powerful, Mr. log4net, why do you whimper and shy away in the presence of a client app that is sending log messages to a logger / repository that doesn’t exist or isn’t configured? I mean, are you Clark Kent or Superman?
Second: who designs an app to give NO FEEDBACK – zero, zilch, nada, nil – when a message sent to a NAMED SINK can’t be delivered? In my case, I’m looking for a logger called “Com.Foo.Bar” and it didn’t even exist. At least throw me a warning in the Event Viewer. But no, you like to play the strong silent type, wrecking my productivity and causing my face to turn all different shades of purple and making me think Very Bad Thoughts like “I’ll just take this here laptop and play Ultimate Frisbee with it.”
Third: this is probably a .NET thing, but why isn’t my Global class pulled in to the project when I compile? Why do I need the actual .asax file? All my code is in the code-behind .cs file. It’s almost like if Global.asax doesn’t exist, the Application_Start never gets fired. Weird.
</on></flame>
So, bottom line for the others out there: make sure that you pull across your .asax file, if you’re using the Application_Start() method to configure your log4net system.