#henrik

development and technology stuff

ASP.NET and log4net

My favorite way to configure log4net for ASP.NET applications was via the Global.asax way. Just use the single line:

log4net.Config.XmlConfigurator.Configure();

This worked for the VS2005 style webpage projects. Since the change in VS2008 to web-application projects instead of webpage projects the Global.asax trick does not work any more. For web-application projects one has to configure log4net via an assembly directive in AssemblyInfo.cs. When put there everything works as expected:

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

Thanks for the config hints to haacked!

Filed under  //   Development   c#   log4net  
Posted July 9, 2009