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;
	log.info("Building and starting the server:");
	builder = new AppiumServiceBuilder();
	builder.usingPort(4723);
	builder.withCapabilities(capabilities);
	builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
	builder.withArgument(GeneralServerFlag.LOG_LEVEL, LogLevel);
	service = AppiumDriverLocalService.buildService(builder);
	service.start();
	log.info("Server started on Port - " + 4723);
}

public static void stopServer() {
	try {
		log.info("Trying to stop the server...");
		service.stop();
		log.info("Success, Server stopped.");
	} catch (Exception e) {
		log.info("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);

I see many comments here, but my questions is how can i run my appium as administrator? From code level? As in my case my windows app needs to be run as administrator. for that i need to run my appium as administrator.

As for i know, running a command prompt as administrator and launching will launch as admin mode, but i want that to be in code… Is there a capability in appiumservicebuilder to launch as admin?