Castle 日志记录工具和 log4net.Config.XmlConfigurator
Castle 日志记录工具是否支持 log4Net.Config.XmlConfigurator.ConfigureAndWatch() 那样的任何功能?我想使用 Windsor 日志记录工具,但我真的希望能够在运行时更改日志记录配置。谁能指出我如何实现这一目标的方向?
Does the Castle Logging Facility support anything in the way of what log4Net.Config.XmlConfigurator.ConfigureAndWatch() does? I'd like to use the Windsor logging facility but I'd really like to be able to change the logging config at runtime as well. Can anyone point me in the direction of how I'd accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据这个文件 在 Castle 源存储库中,Castle log4net 实现确实(或可以)执行ConfigureAndWatch。我没有使用过 Castle,所以我无法评论具体如何利用它。我的第一个猜测是它应该“正常工作”。如果您正在使用 Castle 并且可以将其日志记录配置为使用 log4net,那么您可能已经获得了ConfigureAndWatch。如果您在 log4net 自己的配置文件(而不是 app.config 或 web.config)中配置 log4net,ConfigureAndWatch 可能才起作用。测试(如果您已经在使用 Castle)看看ConfigureAndWatch 是否按预期工作应该不会太困难。
如果您尚未使用 Castle,您可能需要等待更熟悉 Castle 和 Castle 日志记录的人来发布答案。
这是另一篇关于 Castle 日志记录的 SO 帖子,您可能会发现它有帮助:
This one shown log4net configuration in the app.config/web.config (接受的答案来自 2010 年 2 月。我不知道是否有更多可用的最新信息或不是):
使用 Castle.Facilities.Logging 和 log4net 进行日志记录
祝你好运!
According to this file in the Castle source repository, the Castle log4net implementation does (or can) do a ConfigureAndWatch. I haven't used Castle, so I can't comment on exactly how to take advantage of this. My first guess is that it should "just work". If you are using Castle and you can configure its logging to use log4net, you might already be getting ConfigureAndWatch. It is possible that ConfigureAndWatch only works if you configure log4net in its own config file (as opposed to the app.config or web.config). It should not be too difficult to test (if you are already using Castle) to see if ConfigureAndWatch works as expected.
If you are not using Castle already, you might want to wait for someone more familiar with Castle and Castle logging to post an answer.
Here are another SO post about Castle logging that you might find helpful:
This one shows log4net configuration in the app.config/web.config (the accepted answer is from February 2010. I don't know if there is more recent information available or not):
Logging with Castle.Facilities.Logging and log4net
Good luck!