title: Multi-tenant logging in ASP.NET MVC application
body: <p>I have a multi-tenant application in ASP.NET MVC 5 that can accept client logins from multiple companies. Currently, I'm using log4net to log to files, but it places all the logs from all the companies in one file. Ideally, I would like to separate out the log files so that the logs for each company resides in its own folder.</p>
  
  <p>I see from <a href="https://stackoverflow.com/questions/308436/log4net-programmatically-specify-multiple-loggers-with-multiple-file-appenders">this question</a> that I can programmatically create additional appenders, which then can log to different log files. But that would mean that for each instance of a class, I would have to keep calling </p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>ILog log = LogManager.GetLogger("CompanyA");
  </code></pre>
  
  <p>to get the correct logger, right? Is there a better way to do so? I'm also open to using another logger if need be.</p>
  
  <p>Thanks.</p>