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

查看:33
本文介绍了跨应用程序域的 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-user 邮件列表有一个适用于 RollingFileAppender 的答案.将以下行添加到 log4net.config 中的 appender:

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天全站免登陆