AppiumDriverLocalService console logging

Hi,

I am using the new AppiumDriverLocalService and I’m loving it. The only thing that is bothering me, is that my IDE console is filled with appium server logs. Is there any way to set console level logging of appium server to OFF, and just have the --log-level flag applied to FILE logging?

I would like to have a clean console, and appium server log messages in the file specified by the .withLogFile(…) of the AppiumDriverLocalService class.

Thank you,
S

1 Like

Hello S

I am seeking a resolution to this as well. Were you eventually able to figure out how to disable the logging from Appium Server to the console?

Thanks
Tanveer

Hey,

Nope. I just set logging level to ERROR for 99% of the times, and in the 1% of the time I want to see server logs (for some debugging issue) I change the logging level to DEBUG.

Still waiting for guys on Appium side to bring a solution to this.

Yeah it would be awesome…
Btw how you change the logging level ?
Regards

I changed the log4j log level to Error, but that does not stops printing Appium service logs.
Is there a way to disable Appium service logs yet ?

I also tried below but does not works.
service = AppiumDriverLocalService.buildDefaultService();
service.start();

    OutputStream outputStream =new FileOutputStream(System.getProperty("user.dir") + "/App/test.txt");
    service.sendOutputTo(outputStream);

It looks like there is a workaround described in this PR (unmerged).

Yes The work around mentioned in PR works.

You can use below lines of code which worked for me :

AppiumDriverLocalService service;
AppiumServiceBuilder serviceBuilder;

service = AppiumDriverLocalService. buildService (serviceBuilder);
service.start();
service.clearOutPutStreams();

You can set serviceBuilder to get the logs in a file and then just use service.clearOutPutStreams() in the end. It will not produce any console logs.

3 Likes

Hello Zenab_Gorach

Thank you, it works!:cowboy_hat_face:

AppiumDriverLocalService service;
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
...
serviceBuilder.withLogFile(new File("my_appium_server.log"));
...
service = AppiumDriverLocalService.buildService(serviceBuilder);
service.clearOutPutStreams();
service.start();