I have an application (a console application that is a self-service ASP.Net WebAPI) that calls XmlConfigurator.Configure() as part of its configuration.
It works fine if the app.config application app.config looks like this:
<configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> </configSections> <log4net> </log4net> </configuration>
It freezes if I take out an empty <log4net> element:
<configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> </configSections> </configuration>
I have not seen this behavior elsewhere when using log4net in the past (usually it just sends the message "log4net: ERROR XmlConfigurator: could not find the configuration section" log4net "in the application's .config file." Console).
Am I doing something wrong or am I stumbled upon an error in log4net?
I debugged this widely. There are two types of behavior:
XmlConfigurator.Configure() call hangs endlessly when I go through it- the call to
XmlConfigurator.Configure() may be stepped over, but then the application seems to freeze. If I paused execution and looked at the active threads, then one got stuck in the log4net method (something like ConfigureFromFile ).
In any case, this freezes the entire application.
Here is the stack from the freeze thread (in the second case above):

source share