How do I pass log4net config file thru code to Castle.Facilities.Logging.LoggingFacility.UseLog4Net?

StackOverflow https://stackoverflow.com/questions/13214252

سؤال

I am using the following code from castle windsor documentation. I can't figure out how to pass in my configFile on my bootstrapper container installer that installs this installer.

 public void Install(IWindsorContainer container, IConfigurationStore store)
    {
        container.AddFacility<LoggingFacility>(f => f.UseLog4Net("NameOfConfigFile"));
    }
هل كانت مفيدة؟

المحلول 2

The only way I have been able to do this is by newing up my installer and passing in the NameOfConfigFile and in the constructor of my installer setting a private instance field to this value.

_bootStrapContainer = new WindsorContainer().Install(new LoggerInstaller(configPath));

نصائح أخرى

By default I believe it will use a logging.config on the root of the project. Do you still need to use something more customized than that?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top