How to write appium server logs to a file?

I am currently working in java platform and using code
appiumLogs = driver.manage().logs().get(“logcat”).getAll();

but with this command i get logs of my android devices. Is there any way to get
Appium server’s logs?

Hi paras,

In General settings of Appium you can check the “Log To File” box. Then, with java code, read the txt file .

hope it helps…

I am starting appium server from code itself using
Runtime.getRuntime().exec(“cmd.exe /c start appium”);

is there any way to set the log to file flag true from code?
and set the path of file also.

Thanks for the reply!