如何为 ELMAH MongoDB 配置自定义集合名称?

How to configure custom collection name for ELMAH MongoDB?

自动创建的用于存储错误的默认集合名称是"Elmah"。有没有办法指定自定义集合名称?

原因是有 2 个或更多应用程序共享同一个 Mongo 数据库,但不会混淆单个集合中的所有错误(所有应用程序都将指向 "Elmah" 集合)。

我希望在 web.config 中添加一个附加参数,例如:

<errorLog type="Elmah.MongoErrorLog, Elmah.MongoDB.Driver2, Version=2.1.0.0,
Culture=neutral, PublicKeyToken=null" connecionStringName="ELMAH.MongoDB" 
maxSize="10485760" maxDocuments="10000">

在反编译时找到解决方案 Elmah.MongoDB.Driver2。代码使用 'Elmah' 字符串 + 应用程序名称设置的组合。所以解决方案是将应用程序名称添加到我上面提到的 web.config 中 Elmah MongoDB 配置的 errorLog 节点中:

<errorLog type="Elmah.MongoErrorLog, Elmah.MongoDB.Driver2, Version=2.1.0.0,
Culture=neutral, PublicKeyToken=null" connecionStringName="ELMAH.MongoDB" 
maxSize="10485760" maxDocuments="10000" applicationName="your_custom_name">