流畅的 log4net 配置
任何人都知道是否有一种流畅的方式来配置 log4net(附加程序和附加程序的所有属性等...)。
xml快把我逼疯了。
或者如果没有,是否有人知道一个不错的 .Net 日志框架,可以轻松流畅地配置并提供与 log4net 类似的功能?
Anyone know if there's a fluent way of configuring log4net (appenders and all the properties for appenders etc...).
The xml is driving me crazy.
Or if not, does anyone know of a decent .Net logging framework that can easily be fluently configured and offer similar features to log4net?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
酷酷的欢呼我会看看。在 log4net 中也找到了我要找的东西。
令人烦恼的是,我们已经开始使用 Castle Logging Facility,它似乎只将字符串写入 xml 文件!因此,可能必须考虑通过 DSL 完成所有操作并生成 xml 配置作为预构建步骤。
Cool cheers I'll take a look. Found what I was looking for in log4net too.
Annoyingly we've started using Castle Logging Facility which only seems to take a string to an xml file! So may have to consider doing it all via DSL and generating our xml configs as a pre build step.
如果您不介意对 Microsoft 企业库的依赖,则可以使用 日志记录应用程序块。配置仍然是XML格式,但是你可以直接在Visual Studio中通过图形界面进行编辑,
If you don't mind the dependency on Microsoft's Enterprise library, you could use the Logging Application Block. Configuration is still in XML, but you can edit through a graphical interface directly in Visual Studio,
我对基于 XML 的 log4net 配置感到痛苦。不久前,我对调试它感到非常沮丧,因此我开始为 log4net 构建自己的流畅 API。在 github 上查看 Fluent-log4net 。虽然还不是所有内容都得到 100% 支持,但已经实现了。
我会说,它确实使测试和查看配置变得更加容易。
I feel your pain with the XML-based log4net configuration. I got frustrated enough with debugging it a while ago that I started putting together my own fluent API for log4net. Check out fluent-log4net over on github. Not everything is 100% supported yet, but it's getting there.
It does make testing a viewing the configuration at a glance a lot easier, I will say.
出于这个原因,我已经转移到 NLog
I have since moved to NLog for this very reason