From aee29d1da8e73cf958688231d84994127e36bf76 Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:39:14 +0100 Subject: [PATCH] Log probcli stderr output to Eclipse log, not just Eclipse stderr This is more accessible to the average user. Running Eclipse with visible stderr isn't always easy, depending on the OS. --- de.prob.core/src/de/prob/cli/CliStarter.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/de.prob.core/src/de/prob/cli/CliStarter.java b/de.prob.core/src/de/prob/cli/CliStarter.java index 273591f6..67fc4206 100644 --- a/de.prob.core/src/de/prob/cli/CliStarter.java +++ b/de.prob.core/src/de/prob/cli/CliStarter.java @@ -197,12 +197,12 @@ public final class CliStarter { } private void startOutputLogger(final BufferedReader input) { - stdLogger = new OutputLoggerThread("(Output " + port + ")", input); + stdLogger = new OutputLoggerThread("(Output " + port + ")", input, false); stdLogger.start(); } private void startErrorLogger(final BufferedReader output) { - errLogger = new OutputLoggerThread("(Error " + port + ")", output); + errLogger = new OutputLoggerThread("(Error " + port + ")", output, true); errLogger.start(); } @@ -272,12 +272,15 @@ public final class CliStarter { private final String prefix; + private final boolean logToLog; + private volatile boolean shutingDown = false; - public OutputLoggerThread(final String name, final BufferedReader in) { + public OutputLoggerThread(final String name, final BufferedReader in, boolean logToLog) { super(); prefix = "[" + name + "] "; this.in = in; + this.logToLog = logToLog; } @Override @@ -289,7 +292,9 @@ public final class CliStarter { if (line == null) { break; } - // Logger.log(IStatus.INFO, prefix + line, null); + if (logToLog) { + Logger.log(IStatus.INFO, prefix + line, null); + } System.err.println(prefix + line); } } catch (IOException e) { -- GitLab