use of org.eclipse.n4js.xtext.ide.server.util.LspLogger in project n4js by eclipse.
the class LspServer method setupAndRunWithSystemIO.
private void setupAndRunWithSystemIO(XLanguageServerImpl languageServer, Builder<LanguageClient> lsBuilder) {
N4jscConsole.println(LSP_SYNC_MESSAGE + " on stdio ...");
N4jscConsole.setSuppress(true);
LspLogger lspLogger = languageServer.getLspLogger();
Appender lspLoggerAppender = redirectLog4jToLspLogger(lspLogger);
Appender serverIncidentAppender = copyLog4jErrorsToServerIncidentLogger(languageServer.getServerIncidentLogger());
PrintStream oldStdOut = System.out;
PrintStream oldStdErr = System.err;
try (PrintStream loggingStream = new LoggingPrintStream(lspLogger)) {
System.setOut(loggingStream);
System.setErr(loggingStream);
run(languageServer, lsBuilder, System.in, oldStdOut);
} finally {
System.setErr(oldStdErr);
System.setOut(oldStdOut);
Logger.getRootLogger().removeAppender(serverIncidentAppender);
Logger.getRootLogger().removeAppender(lspLoggerAppender);
}
}
Aggregations