Best practice to include log4Net external config file in ASP.NET

Posted by Martin Buberl on Stack Overflow See other posts from Stack Overflow or by Martin Buberl
Published on 2009-11-13T19:55:22Z Indexed on 2011/01/17 21:53 UTC
Read the original article Hit count: 244

I have seen at least two ways to include an external log4net config file in an ASP.NET web application:

Having the following attribute in your AssemblyInfo.cs file:

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)]

Calling the XmlConfigurator in the Global.asax.cs:

protected void Application_Start()
{
    XmlConfigurator.Configure(new FileInfo("Log.config"));
}

What would be the best practice to do it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET