title: My report logs are getting mixed for different classes in extent report
body: <p>I am trying to run different classes parallarly though testNG to generate one single extent report for all classes. Also I am trying to generate logs for each classes which will be shown in the extent report. However when the extent report is generated I can see that the logs for a test case of  one class is shown in the test case of other class. How to resolve this issue? Below is my code:</p>
  
  <p>//// This is my base class for extent report:</p>
  
  <pre><code> @BeforeSuite
      public static void setUp()
      {
          htmlReporter = new ExtentHtmlReporter(System.getProperty("user.dir") +"/test-output/MyOwnReport.html");
          report = new ExtentReports();
          report.attachReporter(htmlReporter);
          report.setSystemInfo("OS", "Mac Sierra");
          report.setSystemInfo("Host Name", "Testing Xpert");
          report.setSystemInfo("Environment", "QA");
          report.setSystemInfo("User Name", "Vivek");
          htmlReporter.config().setChartVisibilityOnOpen(true);
          htmlReporter.config().setDocumentTitle("AutomationTesting.in Demo Report");
          htmlReporter.config().setReportName("My Own Report");
          htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
          htmlReporter.config().setTheme(Theme.DARK);
  
      }
  
    //Creating a method getScreenshot and passing two parameters 
    //driver and screenshotName
  
  
  
  
       public static String getScreenshot(WebDriver driver, String screenshotName) throws Exception {
                        //below line is just to append the date format with the screenshot name to avoid duplicate names      
                        String dateName = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
              TakesScreenshot ts = (TakesScreenshot) driver;
              File source = ts.getScreenshotAs(OutputType.FILE);
  
              String destination = System.getProperty("user.dir") + "/test-output/"+screenshotName+dateName+".png";
              File finalDestination = new File(destination);
              FileHandler.copy(source, finalDestination);
              //FileUtils.copyFile(source, finalDestination);
  
              return destination;
        }
  
          @AfterMethod
          public void getResult(ITestResult result) throws Exception
          {
  
  
              if(result.getStatus() == ITestResult.FAILURE)
              {
                   test.log(Status.FAIL, "Test Case Failed is "+result.getName());
              //   test.log(Status.FAIL, "Test Case Failed is "+result.getThrowable());
                   String screenshotPath = ExtentReportBaseClass.getScreenshot(UtilityMethods.getdriver(), result.getName());
                   test.log(Status.FAIL, (Markup) test.addScreenCaptureFromPath(screenshotPath));
                  //test.log(Status.FAIL, MarkupHelper.createLabel(result.getName()+" Test case FAILED due to below issues:",test.addScreenCaptureFromPath(screenshotPath)));
  
                  test.fail(result.getThrowable());
              }
              else if(result.getStatus() == ITestResult.SUCCESS)
              {
                  test.log(Status.PASS, "Test Case Passed is "+result.getName());
  
              }
              else
              {
                  test.log(Status.SKIP, MarkupHelper.createLabel(result.getName()+" Test Case SKIPPED", ExtentColor.ORANGE));
                  test.skip(result.getThrowable());
              }
          }
  
          @AfterSuite
          public void tearDown()
          {
  
              report.flush();
          }
  </code></pre>
  
  <p>There are my two classes which i am running. Method for generating logs are defined in the class.(test.log(test.getStatus(), "This will add item to the cart");<a href="https://i.stack.imgur.com/76BLX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/76BLX.png" alt="enter image description here"></a>)</p>
  
  <pre><code>public class PurchaseItemTestCase extends ExtentReportBaseClass{
      @BeforeClass
          public void launchBrowser() throws InterruptedException {
  
              //System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
              //driver = new ChromeDriver();
              driver = util.openBrowser(ConstantsValues.BROWSER_NAME);
  
              util.launchWebsite();
              driver.manage().window().maximize();
              //report = ExtentReportBaseClass.setUp();
  
          }
  
          @Test
  
          public void chkPurchaseItem() throws InterruptedException {
              //ExtentTest test;
              test = report.createTest("chkPurchaseItem", "This will check status for purchasing an item.");
              driver.findElement(By.xpath("//img[@title='Faded Short Sleeve T-shirts']")).click();
  
              driver.switchTo().defaultContent();
              driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(@id,'fancy')]")));
  
              System.out.println("after frame");
              Thread.sleep(4000);
              test.log(test.getStatus(), "This will add item to the cart");
              driver.findElement(By.xpath("//button[@type='submit']//span[contains(.,'Add')]")).click();
              Set handles = driver.getWindowHandles();
  
              System.out.println(handles);
  
              // Pass a window handle to the other window
  
              for (String handle1 : driver.getWindowHandles()) {
  
                  System.out.println(handle1);
  
                  driver.switchTo().window(handle1);
  
                  Thread.sleep(3000);
                  driver.findElement(By.xpath("//a[@title='Proceed to checkout']//span[contains(.,'Proceed')]")).click();
                  Thread.sleep(3000);
                  driver.findElement(By.xpath(
                          "//a[@class='button btn btn-default standard-checkout button-medium']//span[contains(.,'Proceed')]//i[@class='icon-chevron-right right']"))
                          .click();
                  test.log(test.getStatus(), "We will login to the account");
                  driver.findElement(By.id("email")).sendKeys("vivekkumar009@gmail.com");
                  driver.findElement(By.id("passwd")).sendKeys("vivek123");
                  Thread.sleep(3000);
                  // UtilityMethods.getdriver().findElement(By.id("SubmitLogin"));
                  driver.findElement(By.id("SubmitLogin")).click();
                  test.log(test.getStatus(), "User will add address for shipment");
                  driver.findElement(By.name("processAddress")).click();
                  test.log(test.getStatus(), "User will agree to terms and condition ");
                  driver.findElement(By.id("cgv")).click();
                  driver.findElement(By.xpath("//button[@name=\"processCarrier\"]")).click();
                  driver.findElement(By.className("cheque")).click();
                  test.log(test.getStatus(), "User confirms order");
                  driver.findElement(By.xpath("//span[contains(text(),'I confirm my order')]")).click();
                  boolean chkElement = util.getdriver().findElement(By.className("home")).isDisplayed();
                  System.out.println(chkElement);
                  Assert.assertTrue(chkElement);
  
              }
  </code></pre>
  
  <p>this is the 2nd class:</p>
  
  <pre><code>public class CategoryWisePurchase extends ExtentReportBaseClass {   
  
      @BeforeClass
          public void launchApplicationBrowser() {
  
              util.openBrowser(ConstantsValues.BROWSER_NAME);
              util.launchWebsite();
  
          }
  
          @Test
  
          public void CategoryWiseShopping() throws InterruptedException {
  
              test = report.createTest("Category Wise Shopping", "This will check if the user is able to shop different products by selecting its category");
              // Actions actions = new Actions(UtilityMethods.getdriver());
              Actions action = new Actions(UtilityMethods.getdriver());
              test.log(test.getStatus(), "User will select the category of a particular item");
              WebElement mainMenu = UtilityMethods.getdriver().findElement(By.xpath("//a[@title='Women']"));
              WebElement subMenu = UtilityMethods.getdriver().findElement(By.xpath("//a[@title='T-shirts']"));
  
              action.moveToElement(mainMenu).build().perform();
              Thread.sleep(2000);
  
              action.moveToElement(subMenu).click().build().perform();
              test.log(test.getStatus(), "Various products will be shown to the user of the selected category");
              //reportLog("Various products will be shown to the user of the selected category");
              boolean chkElement = UtilityMethods.getdriver().findElement(By.xpath("//form[@method='post']")).isDisplayed();
              System.out.println(chkElement);
              Assert.assertTrue(chkElement);
  
          }
  
  }
  </code></pre>