How can I print Appium server log on a file?


#1

Hi !
How can I print the appium server log on a file ? I tried with --log flag but it doesn’t work


#2

We redirect stdout and stderr to a log file when launching the appium server


#3

Tomorrow I will try and I’ll let you know :slight_smile:


#4

Hi,

Did you suceed in printing appium server logs to a file?


#5

Yes ! At the begin I did a mistake because i used --log flag but I wrote the path without the filename ! Now with the correct path It works !


#6

Can you share us the code ?


#7

On Linux you may try to use $ appium server >> my_logs.txt which will redirect output to my_logs.txt file


#8

If you start/stop Appium server from code, then the output will be displayed in console. After that you can use any standard method to print this console in text file.

Example, if you are using maven, then you can use Run -> Run Configurations… -> -> Common tab and then set output file location.


#9

just try this:

AppiumDriverLocalService service = new AppiumServiceBuilder()
				.withIPAddress("")
				.usingAnyFreePort()
				.usingDriverExecutable(new File(""))
				.withAppiumJS(new File(""))
				.withLogFile(new File("")) <<<-------------------This will do the trick
				.build();


#10

Hi, Can you please share how it can be done