如何配置log4net的为WCF [英] How to configure log4net for WCF
问题描述
在我的asp web表单的应用程序,我会做的log4net的初始化;
On my asp webforms app I would do the log4net initialization;
log4net.Config.XmlConfigurator.Configure();
在Global.asax中的的Application_Start,以便应用程序启动时它完成一次。
on global.asax on Application_Start so that it is done once when the application starts.
什么是log4net的配置为IIS托管WCF应用程序(询问具体在哪里放置这条线要使用的事件等)的正确方法,这样的log4net被初始化一次并没有不必要的初始化。
What is the right way of configuring log4net for IIS hosted WCF apps(asking specifically about where to place this line which event to use etc) so that log4net gets initialized once on and there is no unnecessary initializations.
推荐答案
同样的事情:的Application_Start
。毕竟这是一个ASP.NET应用程序。对于自托管服务,你可以配置 log4net的
之前启动主机。
Same thing: Application_Start
. After all it is an ASP.NET application. For self hosting services you could configure log4net
just before starting the host.
这篇关于如何配置log4net的为WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!