Don't show the logs in the intellij consol when start server by programming

hi i start my server by programation and the logs appear in the consol of intellij
at first i thought that was great but now i want to see only my logs in intellij and stock the appium logs outside …
if you have an idea or if you know a tuto please tell me :slight_smile:

Could you send your code here?

public static void appiumStart () throws IOException, InterruptedException {
		//Set path of your node.exe file.
		// Progra~1 represents Program Files folder.
		String nodePath = "C:\\Appium\\node.exe";
		// Set path of your appium.js file.
		String appiumJSPath = "C:\\Appium\\node_modules\\appium\\bin\\appium.js";

		// Created object of apache CommandLine class.
		// It will start command prompt In background.
		CommandLine command = new CommandLine("cmd");
		// Add different arguments In command line which requires to start appium server.
		//Set Server address
		//Set Port
		//Set path to store appium server log file.
		// Execute command line arguments to start appium server.
		DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
		DefaultExecutor executor = new DefaultExecutor();
		executor.execute(command, resultHandler);
		// Wait for 15 minutes so that appium server can start properly before going for test execution.
		// Increase this time If face any error.

ok my bad i already stock it outside in the C://appiumLogs.txt file, but i don’t know how to remove the logs from intellij

I’m not too familiar with the Apache Commons Exec library, but I believe that the DefaultExecutor’s stream handler is just outputting Appium’s standard out to your Java process’s standard out, so you’ll be seeing both processes’ output. If you want to discard Appium’s standard out, you can set your own stream handler that just reads from Appium’s output and does nothing with it.

thx i’ll try it today or tomorrow ,
i’ll reply you again to tell the result :slight_smile:

so i finally found a solution. By searching from your issue someone told me to use the logs levels and then i just used these lines commands

command.addArgument("C://Appium//Logs//appiumLogs" + System.currentTimeMillis() + ".txt");

now it’s show me only errors so when the server crash.
i don’t see anymore the infos

------> but no more info in the files where i want to stock the informations … <-------

reEdit : i just finished what you told me to do it’s work fine :smiley:

		// Execute command line arguments to start appium server.
		DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
		PumpStreamHandler streamHandler = new PumpStreamHandler(new FileOutputStream("C:\\ Device nexus Logs.txt"));
		DefaultExecutor executor = new DefaultExecutor();
		executor.execute(command, resultHandler);
1 Like