private void write2LogFile(ITestResult iTestResult, File testFolder) {
   BufferedWriter out = null;
   try {
     if (testFolder == null) {
       LogUtils.log("Can not write to file test folder is null");
       return;
     }
     String output = SGTestNGReporter.getOutput();
     if (StringUtils.isEmpty(output)) {
       LogUtils.log("nothing to write to log file");
       return;
     }
     String parameters = TestNGUtils.extractParameters(iTestResult);
     File testLogFile =
         new File(
             testFolder.getAbsolutePath()
                 + "/"
                 + iTestResult.getName()
                 + "("
                 + parameters
                 + ").log");
     if (!testLogFile.createNewFile()) {
       LogUtils.log(
           "Failed to create log file ["
               + testLogFile
               + "];\n log output: "
               + Reporter.getOutput());
       return;
     }
     FileWriter fstream = new FileWriter(testLogFile);
     out = new BufferedWriter(fstream);
     out.write(output);
   } catch (Exception e) {
     LogUtils.log("Failed to write to log file result - " + iTestResult, e);
   } finally {
     SGTestNGReporter.reset();
     if (out != null) {
       try {
         out.close();
       } catch (IOException e) {
         LogUtils.log("Failed closing stream", e);
         // ignore
       }
     }
   }
 }