我可以有多个 log4net 配置文件吗?
我可以有多个 log4net 同一个程序的配置?类似于 Spring 的
元素的功能将是最佳的。这里的想法是让多个程序拥有自己的 log4net 配置,并共享包含共享错误日志的中央 log4net 配置文件(以便不重复定义)。或者,此功能是否可以通过 .NET 通用日志记录实现?
Can I have multiple log4net configurations for the same program? Functionality similar to Spring's <import>
element would be optimal. The idea here would to have multiple programs that have their own log4net configuration, as well as sharing a central log4net configuration file containing a shared error log (so that definition isn't repeated). Alternatively is this functionality possible with .NET Common Logging?
Related: log4net - configure using multiple configuration files
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过使用命名存储库来实现此目的,我认为
然后通过使用
您可以获得相应的记录器。
you can achieve this by using named repositories i think
then by using
you can get the corresponding logger.
不是开箱即用的。您必须自己实现将不同配置文件合并到单个 XmlNode 中并将其传递给 log4net XmlConfiguratot。
可以在这里找到一个示例: http://www .kopf.com.br/kaplof/using-multiple-configuration-files-with-log4net
Not out-of-the-box. You must implement yourself the merging of different config files into a single XmlNode and pass this to log4net XmlConfiguratot.
An example is to be found here: http://www.kopf.com.br/kaplof/using-multiple-configuration-files-with-log4net