'Log4net: Multiple configuration files but only one actually used

I am trying to refactor a little bit outdated code and can not find solution for log4net logs: I have multiple project each one of them defined it own log4net logger like this:

(using Common.Logging.Log4net.Universal and Common.Logging.Core and Common.Logging, log4net version 2.0.12.0)

app.config

...
...
<configSections>
    <sectionGroup name="common">
        <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
</configSections>

<common>
    <logging>
        <factoryAdapter type="Common.Logging.Log4Net.Universal.Log4NetFactoryAdapter, Common.Logging.Log4Net.Universal" />
    </logging>
</common>

<appSettings>
    <add key="log4net.Config" value="Current.Project.Unique.Name.log4net.config" />
    <add key="log4net.Config.Watch" value="True" />
</appSettings>
...
...

and actual Current.Project.Unique.Name.log4net.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>

    <log4net>
        <appender name="CurrentProjectUniqueAppenderName" type="log4net.Appender.RollingFileAppender">
            <file value="LogFolder\Current.Project.Unique.Name.log" />
            <appendToFile value="true" />
            <rollingStyle value="Size" />
            <maxSizeRollBackups value="10" />
            <maximumFileSize value="1MB" />
            <staticLogFileName value="true" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
        </appender>

        <root>
            <level value="ALL" />
            <appender-ref ref="CurrentProjectUniqueAppenderName" />
        </root>

    </log4net>
</configuration>

and in code I am trying to use this logger like this:

private static readonly ILog Logger = LogManager.GetCurrentClassLogger();

private void function1()
{
  Logger.Debug("I am logging here");
}

so it look like everything OK and should work but actually what happens that only 'Startup project' actually reading (?) and using xxx.log4net.configuration file (it's own) and no other project is reading or using they <project.name>.log4net.configuration file.

Why is this ? How I can configure log4net so each project will use it own configuration file and only fallback to startup-project configuration in case it own is not defined ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source