See: Elmah Error Logging with MongoDB Official Driver
ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.
This provider enables MongoDB to be used as the back-end storage via the Official 10gen provider.
The easiest way to add this to a project is via the elmah.mongodb NuGET package which will add the required assemblies to your project.
The provider supports multiple per-application collections within a single database and will automatically create a MongoDB Capped Collection called 'Elmah' if the application name is not set or will use Elmah-ApplicationName if it is.
The size of the MongoDB collection can be controlled by setting the maxSize (bytes) and maxDocuments properties. By default a 100mb collection is used (with no document limit).
Here is an example configuration:
<elmah>
<errorLog type="Elmah.MongoErrorLog, Elmah.MongoDB" connectionStringName="elmah-mongodb" maxSize="10485760" maxDocuments="10000"/>
</elmah>
<connectionStrings>
<add name="elmah-mongodb" connectionString="mongodb://localhost/elmah?w=0"/>
</connectionStrings>