跨应用程序域的log4net [英] log4net across appdomains

查看:61
本文介绍了跨应用程序域的log4net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,该应用程序从一个应用程序域初始化log4net,并且需要在另一个应用程序域中使用它.支持吗?

I have an application which initializes log4net from one appdomain and needs to use it in another appdomain. Is it supported?

如果没有,我应该从每个应用程序域初始化log4net吗?同一应用程序中的多次初始化有风险吗?我应该使用相同的log4net.config吗?

If not, should I initialize log4net from each appdomain? Is there a risk in multiple initializations in the same application? Should I use the same log4net.config?

推荐答案

log4net用户邮件列表提供了与RollingFileAppender一起使用的答案.将以下行添加到log4net.config中的附加程序:

The log4net-user mailing list has an answer that works with RollingFileAppender. Add the following line to the appender in log4net.config:

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

这篇关于跨应用程序域的log4net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆