Introducing the Couchbase ELMAH Error Log Provider
If you're an ASP.NET developer, there's a good chance you've heard of the ELMAH project. In case you haven't, ELMAH (Error Logging Modules and Handlers) is a series of HTTP modules and an HTTP handler that may be added to your ASP.NET web applications for the purpose of tracking unhandled exceptions. ELMAH provides access to view these errors by way of a web console, email notifications and an RSS feed.
So where does ELMAH store all of these exceptions as they're raised? The answer, fortunately, is that it's configurable. Out of the box, ELMAH ships with providers for several relational databases (remember those?), an in-memory store and XML files. Though not in the box, you are now able to add Couchbase to the list of available entry logs. Yesterday, I posted the ELMAH Couchbase provider to Couchbase Labs - https://github.com/couchbaselabs/elmah-couchbase.
Why use Couchbase for ELMAH? If some part of your application suddenly starts throwing exceptions, do you want to be clogging your over-taxed RDBMS with writes or would you rather hand over logging responsibility to a database that can handle tens-if-not-hundreds of thousands of operations per second on a single node. OK, hopefully you're application isn't going to need that kind of throughput for logging exceptions. But if that day comes...
To get started with the new provider, you'll need fist to install ELMAH (try the Nuget package that includes configuration, not core). For more information on how to setup ELMAH, see these community links. After installed, grab the Couchbase ELMAH Log Entry source from GitHub or get the latest Nuget package. Configure ELMAH to use the new error log in Web.config.
<errorlog couchbaseconfigsection="<other-than-default-couchbase-section-name>" type="Elmah.Couchbase.CouchbaseErrorLog, Elmah.Couchbase" />
</elmah>
if (doc.Exception) {
emit(doc.Time, null);
}
}