Log4net

From Richard's Wiki
Jump to: navigation, search
  • Declare a Logger without explicitly naming the calling type (use reflection):
using System.Reflection;
private readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]