How to write multiple Selenium WebDriver session logs into different files when they run parallel using java
<p>Looking for a solution to write <strong>step by step</strong> execution details of Selenium webDriver scripts into a file. Logs need to be added to files which are created for each 'Tests' in <strong>testng.xml</strong> and are running on the different browser.
That has been achieved for 'one session' by implementing <strong>WebDriverEventListener</strong>.(But I don't have an idea of writing each driver instance custom logs into different files within a single method)
But looking for a solution to bind each 'log files' with 'Webdriver instances' and write respective browser actions into it.</p>

<pre><code>@Parameters({"BrowserName"})    
@BeforeTest
public void createDriver(String BrowserName) {
    switch (BrowserName) {
    case "Chrome":
        System.setProperty("webdriver.chrome.driver",
                System.getProperty("user.dir") + "//BrowserExes//chromedriver.exe");
        Driver = new ChromeDriver();
        eventFiringDriver = new EventFiringWebDriver(Driver);
        eventListener = new CustomWebDriverListener(Driver);
        eventFiringDriver.register(eventListener);
        break;

    case "IE":
        System.setProperty("webdriver.ie.driver",
                System.getProperty("user.dir") + "//BrowserExes//IEDriverServer.exe");
        Driver = new InternetExplorerDriver();
        eventFiringDriver = new EventFiringWebDriver(Driver);
        eventListener = new CustomWebDriverListener(Driver);
        eventFiringDriver.register(eventListener);

    default:
        break;
    }

}


@Test
public void loadURL(){
  eventFiringDriver.get("https://www.google.com");
}
</code></pre>

<p>I have created report files by implementing <strong>ISuiteListener</strong> based on the number of TestNG tests.</p>

<pre><code>&lt;suite name="Suite" parallel="tests"&gt;
&lt;test name="Test"&gt;
    &lt;parameter name="BrowserName" value="Chrome"&gt;&lt;/parameter&gt;
    &lt;classes&gt;
        &lt;class name="eventFiringWebDriver.EventDriver"&gt;&lt;/class&gt;
    &lt;/classes&gt;
&lt;/test&gt;
&lt;test name="Test_2"&gt;
    &lt;parameter name="BrowserName" value="IE"&gt;&lt;/parameter&gt;
    &lt;classes&gt;
        &lt;class name="eventFiringWebDriver.EventDriver"&gt;&lt;/class&gt;
    &lt;/classes&gt;
&lt;/test&gt;
</code></pre>

<p></p>