Showing posts with label log4net. Show all posts
Showing posts with label log4net. Show all posts

Tuesday, March 02, 2010

Quick and Dirty Guide to Configuring Log4Net For Web Applications

This line of code is a gem:
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

Quick and Dirty Guide to Configuring Log4Net For Web Applications


My code:
private static readonly ILog Log { get; set; }

static ClassConstructor()
{
    Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
    log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(HttpContext.Current.Server.MapPath("~/log4net.config")));
}