3
votes

I have created a separate console application for the logging and then added that single console dll to more than one application for logging. As soon as I run the application, it is logging well but also showing the following error

 log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .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: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the and elements. The configuration section should look like:

any idea?

2

2 Answers

2
votes

Add

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

</configuration>

to your app/web.config file

1
votes

First guess: The application, you add your dll to doesn't have a log4net config section in its configuration file. If that's the case either add a log4net config section to the application's config or use another way to configure log4net (eg. read config from a file which 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's config).