title: log4net initialisation
body: <p>I've looked hard for duplicates but have to ask the following, no matter how basic it may seem, to get it clear once and for all!</p>
  
  <p>In a fresh Console app using log4net version 1.2.10.0 on VS28KSP1 on 64 bit W7, I have the following code:-</p>
  
  <pre><code>using log4net;
  using log4net.Config;
  
  namespace ConsoleApplication1
  {
      class Program
      {
          static readonly ILog _log = LogManager.GetLogger(typeof(Program));
          static void Main(string[] args)
          {
              _log.Info("Ran");
          }
      }
  }
  </code></pre>
  
  <p>In my <code>app.config</code>, I have:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt;
    &lt;/configSections&gt;
    &lt;log4net&gt;
      &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
        &lt;file value="Program.log" /&gt;
        &lt;lockingModel type="log4net.Appender.FileAppender+MinimalLock" /&gt;
        &lt;appendToFile value="true" /&gt;
        &lt;rollingStyle value="Size" /&gt;
        &lt;maxSizeRollBackups value="10" /&gt;
        &lt;maximumFileSize value="1MB" /&gt;
        &lt;staticLogFileName value="true" /&gt;
        &lt;layout type="log4net.Layout.PatternLayout"&gt;
          &lt;conversionPattern value="[%username] %date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /&gt;
        &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;root&gt;
        &lt;level value="DEBUG" /&gt;
        &lt;appender-ref ref="RollingFileAppender" /&gt;
      &lt;/root&gt;
    &lt;/log4net&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This doesnt write anything, unless I either add an attribute:</p>
  
  <pre><code>[ assembly:XmlConfigurator ]
  </code></pre>
  
  <p>Or explicitly initialise it in Main():</p>
  
  <pre><code>_log.Info("This will not go to the log");
  XmlConfigurator.Configure();
  _log.Info("Ran");
  </code></pre>
  
  <p>This raises the following questions:</p>
  
  <ol>
  <li>I'm almost certain I've seen it working somewhere on some version of log4net without the addition of the assembly attribute or call in Main. Can someone assure me I'm not imagining that?</li>
  <li>Can someone please point me to where in the doc it explicitly states that both the config section and the initialisation hook are required - hopefully with an explanation of when this changed, if it did?</li>
  </ol>
  
  <p>I can easily imagine why this might be the policy -- having the initialisation step explicit to avoid surprises etc., it's just that I seem to recall this not always being the case... (And normally I have the config in a separate file, which generally takes configsections out of the picture)</p>