c# - log4net for IIS WCF service with separate config -
i want use log4net wcf service hosted in iis.
but change settings easily, want use separate config file.
so added web.config (and app.config of wcf service library)
<appsettings> <add key="log4net_config" value="log4net.config" /> </appsettings>
but leads current directory of iis, is
c:\windows\system32\inetsrv
and there never log4net.config file.
but want configure log4net like
var configfile = configurationmanager.appsettings["log4net_config"]; var fileinfo = new fileinfo(configfile); xmlconfigurator.configureandwatch(fileinfo);
how can configure directory fits needs?
first of put full path log4.net config file.
secondly can use system.web.hosting.hostingenvironment.mappath
example resolve path "~/log4net.config"
Comments
Post a Comment