title: Unique log file for each instance of class
body: <p>I am currently running a windows service that creates multiple instances of a class.</p>
  
  <p>At the top of the service class and every other class in my solution, I have something like this:</p>
  
  <pre><code>private static readonly ILog _log = LogManager.GetLogger(typeof(SomeClassTypeHere));
  </code></pre>
  
  <p>In my App.config, I have Log4Net configured for a single file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;log4net debug="true"&gt;
      &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
        &lt;file value="Logs\SomeLogFileName.xml" /&gt;
        &lt;appendToFile value="true" /&gt;
        &lt;rollingStyle value="Size" /&gt;
        &lt;countDirection value="1" /&gt;
        &lt;maxSizeRollBackups value="30" /&gt;
        &lt;maximumFileSize value="10MB" /&gt;
        &lt;staticLogFileName value="true" /&gt;
        &lt;lockingModel type="log4net.Appender.FileAppender+MinimalLock" /&gt;
        &lt;layout type="log4net.Layout.XmlLayoutSchemaLog4j"&gt;
          &lt;locationInfo value="true" /&gt;
        &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;root&gt;
        &lt;level value="INFO" /&gt;
        &lt;appender-ref ref="RollingFileAppender" /&gt;
      &lt;/root&gt;
    &lt;/log4net&gt;
  </code></pre>
  
  <p>This works great in most respects, and everything logs to a single file. However, I'd really like to create a separate log file for each instance of a particular class that my service creates.<br>
  This is a class that we often need to monitor for support and we can have a handful of instances running at the same time.<br>
  We don't know which instances will be running at a given time, so it makes creating static files in the configuration kinda painful.</p>
  
  <p>I tried taking off the readonly modifier and setting the following in the class constructor:</p>
  
  <pre><code>_log = LogManager.GetLogger("DataCollectionClass_" + deviceName + "_" + DateTime.Now.ToString("MMddyyyy"), typeof(SomeClassTypeHere));
  </code></pre>
  
  <p>But that requires that I define an appender manually in the configuration, which would be cumbersome and tough to keep up with.</p>
  
  <p>Any thoughts on doing this in L4N? I have seen links <a href="https://stackoverflow.com/questions/6136251/what-is-the-best-way-to-create-a-log-for-each-instance-of-a-class-in-log4net">here</a> but don't really know if that much frameworking is necessary.</p>