From ba5afc0b1cc485968c991cc29d7852a26a3f8071 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 20 Apr 2021 16:03:01 -0400 Subject: [PATCH] Print errors to standard error if flag set If the environment variable `LEMMINX_DEBUG` is set, then Java's errors will not be disconnected from standard error. Closes #1019 Signed-off-by: David Thompson --- .../src/main/java/org/eclipse/lemminx/XMLServerLauncher.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLServerLauncher.java b/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLServerLauncher.java index 2a43a88e7..d05969791 100644 --- a/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLServerLauncher.java +++ b/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLServerLauncher.java @@ -42,6 +42,7 @@ public static void main(String[] args) { final String HTTP_PROXY_PORT = System.getenv("HTTP_PROXY_PORT"); final String HTTP_PROXY_USERNAME = System.getenv("HTTP_PROXY_USERNAME"); final String HTTP_PROXY_PASSWORD = System.getenv("HTTP_PROXY_PASSWORD"); + final boolean LEMMINX_DEBUG = System.getenv("LEMMINX_DEBUG") != null; if (HTTP_PROXY_HOST != null && HTTP_PROXY_PORT != null) { System.setProperty("http.proxyHost", HTTP_PROXY_HOST); @@ -70,7 +71,9 @@ protected PasswordAuthentication getPasswordAuthentication() { PrintStream out = System.out; System.setIn(new NoOpInputStream()); System.setOut(new NoOpPrintStream()); - System.setErr(new NoOpPrintStream()); + if (!LEMMINX_DEBUG) { + System.setErr(new NoOpPrintStream()); + } launch(in, out); }