title: Log4Net - How to add a 2nd logger used only for specific sections of code
body: <p>I'm using Log4Net 2.0, I have it working as required but which to add another logger for specific log statements. All logging is done to a single file appender. The change I want to make is that a 3rd party application fires events containing debug/error information, I can catch this information and whilst useful I feel it pollutes the normal application log file, and would instead prefer this to be stored in its own log file.</p>
  
  <p>The end result I would like is a file called <code>log-file.txt</code> with all the logging from the application except the 3rd party logging. And a 2nd file called <code>log-file-3rdparty.txt</code> with logging only from the 3rd party application. The problem I have is setting up Log4Net to have 2 seperate loggers. I have already tried creating a 2nd LogFileAppender and adding it to the root however all this does in puts the same logging statements into both loggers.</p>
  
  <p>Across the application we currently have the GetLogger statement as follows. This ideally needs to stay the same, so existing logging is unchanged. I need a new logger that is not affected by this statement, but is instead instantiated purely for 3rd party logging.</p>
  
  <p><code>private readonly ILog _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);</code></p>
  
  <p>And the App.Config as follows.</p>
  
  <pre><code>&lt; log4net&gt;
  &lt;logger name="MyApp.Logging"&gt;
    &lt;level value="DEBUG"/&gt;
  &lt;/logger&gt;
  
  &lt;root&gt;
    &lt;level value="ALL" /&gt;
    &lt;appender-ref ref="LogFileAppender" /&gt;
  &lt;/root&gt;
  
  &lt;appender name="LogFileAppender" type="log4net.Appender.FileAppender" &gt;
    &lt;param name="File" value="log-file.txt" /&gt;
    &lt;param name="AppendToFile" value="true" /&gt;
    &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;param name="Header" value="&amp;#13;&amp;#10;[Application started]&amp;#13;&amp;#10;" /&gt;
      &lt;param name="Footer" value="[Application Finished]&amp;#13;&amp;#10;"/&gt;
      &lt;conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;
  &lt;/ log4net&gt;
  </code></pre>
  
  <p>Can you help?</p>
  
  <p><em><strong>EDIT</em></strong></p>
  
  <p>If it makes any difference. The 3rd party log events are captured in the same class that some of my application log events are also fired from, this is because the class is responsible for controlling the 3rd part software. Is this an issue? I do have some inkling that log4net can differentiate which logger to create based on class names, and if that's the case do i need to refactor the 3rd party logging to its own class?</p>