Log4net logging is not working with parallel threads
<p>I am using basic Parallel.Foreach loop on Random numbers to log number itself using log4net.</p>

<p>Here is my code to log 5000 messages on parallel threads</p>

<pre><code>            Logger logger = new Logger();
            var numbers = Enumerable.Range(1, 5000);
            ParallelOptions parallelOptions =
                   new ParallelOptions()
                   {
                       MaxDegreeOfParallelism = Environment.ProcessorCount
                   };
            Parallel.ForEach(numbers, parallelOptions, number =&gt;
            {
                logger.Write(Level.Info, "main method", "" + number + "", loggingParameters);
            });
</code></pre>

<p>But in the end only see 1600 messages in the log file.</p>

<p>Is this a known issue with log4net ? or am i doing something wrong here ?</p>

<p>I used the below setting in the cofig based on <a href="https://stackoverflow.com/a/15119184/552236">Answer</a>and its still the same. </p>

<pre><code>&lt;param name="ImmediateFlush" value="true" /&gt;

&lt;log4net debug="false"&gt;

    &lt;appender name="GeneralRollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
      &lt;lockingModel type="log4net.Appender.FileAppender+MinimalLock" /&gt;
      &lt;file   type="log4net.Util.PatternString" value="Logs/All/all_" /&gt;
      &lt;appendToFile value="true" /&gt;
      &lt;rollingStyle value="Date" /&gt;
      &lt;datePattern value="yyyyMMdd'.log'" /&gt;
      &lt;maxSizeRollBackups value="10" /&gt;
      &lt;staticLogFileName value="false" /&gt;
      &lt;param name="ImmediateFlush" value="true" /&gt;
      &lt;filter type="log4net.Filter.LevelRangeFilter"&gt;
        &lt;levelMin value="INFO" /&gt;
        &lt;levelMax value="INFO" /&gt;
      &lt;/filter&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%date [%thread] %-5level %message%newline" /&gt;

      &lt;/layout&gt;
    &lt;/appender&gt;
    &lt;root&gt;
      &lt;appender-ref ref="GeneralRollingFileAppender" /&gt;
    &lt;/root&gt;
  &lt;/log4net&gt;
</code></pre>

<blockquote>
  <p>Log4net version : 1.2.15.0</p>
</blockquote>