title: When running tests in parallel how to write log to different files?
body: <p>Fore my tests report I use Allure framework and it allows me to attach a file to a test. I also use SpecFlow so I want to attach a log file to each tests step. And Allure allows me to do it.</p>
  
  <p>Yet, I cannot figure out how to do it in a proper way when my tests are run in parallel. </p>
  
  <p><strong>So what I need is</strong> to have log per each test written to a file that I can handle independently from other log files <strong><em>from tests that run in parallel</em></strong>.</p>
  
  <p>Before I run tests in parallel I simply had a class like this:</p>
  
  <pre><code>public static class Log
  {
      private static readonly string LogFileName = "testlog.json";
  
      public static bool IsFileExist =&gt; File.Exists(LogFileName);
  
      public static void WriteLine(string value)
      {
          File.AppendAllText(LogFileName, value);
      }
  
      public static string GetLogPath()
      {
          return LogFileName;
      }
  }
  </code></pre>
  
  <p>Then I had a SpecFlow hook:</p>
  
  <pre><code>[AfterStep()]
  public void AfterStep()
  {
      if (Log.IsFileExist)
      {
          string logFilePath = Log.GetLogPath();
  
          AllureLifecycle.Instance.AddAttachment("displayedFileName", "application/json", logFilePath);
  
          //Clean log file 
          DeleteTestLogFile();
      }
  }
  </code></pre>
  
  <p>So as soon as log file was attached to my report I removed it and it was created in the next step again.</p>
  
  <p>Now, of-course when I run tests in parallel the file cannot be accessed from multiple threads.</p>
  
  <p>How can I handle this? Maybe I use not good solution at all? If so, please advice a sufficient way to do what I want.</p>