我与log4net一起使用以将日志写入mongodb 我定义了app.config文件:
<log4net>
<appender name="MongoDBAppender" type="ait_drm_logger.MongoAppender, ait-drm-logger">
<CollectionName>action_logs</CollectionName>
<field>
<name value="timestamp" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</field>
<field>
<name value="level" />
<layout type="log4net.Layout.PatternLayout" value="%level" />
</field>
<field>
<name value="thread" />
<layout type="log4net.Layout.PatternLayout" value="%thread" />
</field>
<field>
<name value="logger" />
<layout type="log4net.Layout.PatternLayout" value="%logger" />
</field>
<field>
<name value="message" />
<layout type="log4net.Layout.PatternLayout" value="%message" />
</field>
<field>
<name value="Exception" />
<layout type="log4net.Layout.RawPropertyLayout">
<key value="Exception" />
</layout>
</field>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="MongoDBAppender" />
</root>
</log4net>
我想实时更改集合的名称,因为我想将日志写入MongoDB中的其他集合文档 (从action_logs到api_logs) 如何更改它,或在配置中定义它?