With this code appium logs are printed in console, how to generate appium logs in a separate file.
public class TestBaseclass {
static AppiumDriverLocalService appiumService;
@BeforeClass
public static void startserver() throws Exception {
appiumService = AppiumDriverLocalService.buildDefaultService();
appiumService.start();
}
@AfterClass
public static void stopServer() throws Exception {
System.out.println("Stop appium service");
appiumService.stop();
}
/**
* Configures the appium server to write log to the given file.
*
* @param logFile A file to write log to.
* @return A self reference.
*/
@Override
public AppiumServiceBuilder withLogFile(File logFile) {
return super.withLogFile(logFile);
}
AppiumServiceBuilder expose a method called withLogFile() that will write the logs into a given file.