Log4net: ERROR XmlConfigurator: Could not find configuration section "log4net" in application .config

I created a separate console logging application and then added this single console DLL to several logging applications. As soon as I run the application, it logs well but also shows the following error:

 log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />

      

log4net: ERROR XmlConfigurator: Could not find configuration section "log4net" in application .config file. Check the .config file for items and. The config section should look like this:

any idea?

+3


source to share


2 answers


Add to

<configuration>
    <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
...

</configuration>

      



to app / web.config file

+2


source


First assumption: the application you added your DLL to does not have a log4net config section in the config file. If this case will either add the log4net config section to the application config, or use a different way to configure log4net (for example, read the config from a file that is always next to your DLL, however the preferred way is to have all the config in one place, so I recommend adding a section to the app config).



+1


source







All Articles