This is my error message:
log4net:ERROR XmlConfigurator: Failed to find configuration section \'log4net\' in the application\'s .config file. Check your .con
Are you calling XmlConfigurator.Configure()
somewhere?
Remove those calls and only add the [assembly: log4net.Config.XmlConfigurator(Watch = true)]
attribute.
Normally it is easier to configure log4net in a separate file. Create a file log4net.config
and change your attribute to:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
Remove the section in your web.config
.
Nothing seems wrong with defining the section under <configSections>
.
Try adding [assembly: log4net.Config.XmlConfigurator(Watch = true)]
in your AssemblyInfo.cs in the properties folder of your project. This should do the trick in case your configuration is correct under the tag.
EDIT :
XmlElement log4NetSection = (XmlElement)ConfigurationManager.GetSection("log4net");
log4net.Config.XmlConfigurator.Configure(log4NetSection);