Getting Log4net to work in a .net console application
Sample of a Program.cs file:
private static ILog _log = LogManager.GetLogger(typeof(Program));
static int Main() {
XmlConfigurator.Configure(new FileInfo("log4net.config"));
_log.Info(String.Format("{0} Starting", typeof(Program).FullName));
- You must use a "log4net.config" file instead of attempting to place the log4net config settings inside of App.config.
- Set the log4net.config file to "copy local = true" in vistual studio