How can I print Appium server log on a file?

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

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

1 Like

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

Hi,

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

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 !

Can you share us the code ?

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

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.

just try this:

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

Hi, Can you please share how it can be done

The problem is that the logs are not well formated

[35m[Appium]e[39m Welcome to Appium v1.14.0
2019-07-14 14:44:36:381 - e[35m[Appium]e[39m Non-default server args:
2019-07-14 14:44:36:381 - e[35m[Appium]e[39m   port: 35611
2019-07-14 14:44:36:382 - e[35m[Appium]e[39m   logTimestamp: true
2019-07-14 14:44:36:382 - e[35m[Appium]e[39m   relaxedSecurityEnabled: true
2019-07-14 14:44:36:411 - e[35m[Appium]e[39m Appium REST http interface listener started on 0.0.0.0:35611
2019-07-14 14:44:36:493 - e[35m[HTTP]e[39m e[37m-->e[39m e[37mGETe[39m e[37m/wd/hub/statuse[39m
2019-07-14 14:44:36:493 - e[35m[HTTP]e[39m e[90m{}e[39m

any way to format them properly ?

i tried this code but i don’t find any data.