Launching and stopping appium server programmtically


try to start the server like this, not by giving node path in cmd.

private static AppiumDriverLocalService service;
private static Logger log = LogManager.getLogger(AppiumSetup.class.getName());

public static void startServer(){
	AppiumServiceBuilder builder;"Building and starting the server:");
	builder = new AppiumServiceBuilder();
	builder.withArgument(GeneralServerFlag.LOG_LEVEL, LogLevel);
	service = AppiumDriverLocalService.buildService(builder);
	service.start();"Server started on Port - " + 4723);

public static void stopServer() {
	try {"Trying to stop the server...");
		service.stop();"Success, Server stopped.");
	} catch (Exception e) {"Appium server could not be stopped.");


Thank you @Zuzeac Iā€™m able to open appium server. To show all my server logs in command prompt what can we do. With your code it is showing server logs in my eclipse console.
I want to see server logs and console logs separately


change log level, debug, error, info:
builder.withArgument(GeneralServerFlag.LOG_LEVEL, debug);


I still get the server logs in my console.

builder.withArgument(GeneralServerFlag.LOG_LEVEL, LogLevel);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, debug);

For loglevel and debug I have to create local variables and initialize it right


LOG_LEVEL in my case its a local variabile which is set to error. I do not need the logs. But you should just use error if you do not need logs from appium.
builder.withArgument(GeneralServerFlag.LOG_LEVEL, error);