I understand that this question has been asked several times, but unfortunately, I haven\'t been able to get my logging configuration working. I have to be making some very
You do not need to call the XmlConfigurator manually if you use:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)]
However you have to add the tag to all your dlls (all assambly.cs files).
I have faced exactly the same issue. As you rightly point out, you should not need to explicitly call XmlConfigurator
when you include the line in your AssemblyInfo.cs
. The problem comes when the first use of log4net is in an assebmly that doesn't have that line. In my case I was using the Topshelf.Log4Net NuGet package, and the first log line that my application logged was through that.
You could just log a line early in your app or if you don't need to log anything do what I did and add the following at the entry point of the application
LogManager.GetLogger(typeof(Program));