简体   繁体   English

如何在stdout,stderr上使远程调试JVM不输出文本?

[英]How do I make remote debug JVM not output text on stdout, stderr?

I'm currently writing a language server (atop of lsp4j), and need to debug my language server. 我正在编写一个语言服务器(在lsp4j上面),需要调试我的语言服务器。 Language server protocol servers uses stdin and stdout to communicate with the client. 语言服务器协议服务器使用stdin和stdout与客户端通信。

Now I want to debug a server that is launched from the client (VSCode), so I added in the debug flags for the spawned JVM process: 现在我想调试从客户端启动的服务器(VSCode),因此我在生成的JVM进程的调试标志中添加了:

-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999

Upon doing this suddenly, the server does not work any more, even though suspend = 0 and I confirmed the port is open and that no firewall malarkey is happening. 突然执行此操作后,服务器不再工作,即使suspend = 0并且我确认端口已打开并且没有发生防火墙malarkey。

I decided to run the command line manually, and I see that the first thing that a process does, after it receives the debug parameters is to output the following to stdout: 我决定手动运行命令行,我发现进程在收到调试参数后所做的第一件事是将以下内容输出到stdout:

Listening for transport dt_socket at address: 9999

(emitted without double quotes) (没有双引号发出)

I believe this is the reason that I cannot debug the language server, because outputting anything to stdout or stdin that is not part of the language server protocol spec forces the client to reject the server. 我相信这是我无法调试语言服务器的原因,因为输出任何不属于语言服务器协议规范的 stdout或stdin强制客户端拒绝服务器。

My question therefore, in a roundabout fashion is to ask if it is possible to make internal JVM messages on stdout, stdin, stderr silent via another JVM parameter? 因此,我的问题是,以一种迂回的方式询问是否可以通过另一个JVM参数在stdout,stdin,stderr上生成内部JVM消息?

Update: 更新:

The answer appears to be ",quiet=y" as an additional parameter. 答案似乎是“,quiet = y”作为附加参数。

-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999,quiet=y -Xrunjdwp:交通= dt_socket,服务器= Y,暂停= N,地址= 9999,安静= Y

Thank you to Christian Dietrich for providing the solution on the lsp4j github page. 感谢Christian Dietrich在lsp4j github页面上提供解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在groovy中将输出重定向到stderr? - How do I redirect output to stderr in groovy? 如何调试JVM中的挂起线程? - How do I debug hanging threads in the JVM? Eclipse Java远程调试:如何确保我在项目中获得的代码与JVM中运行的代码相同? - Eclipse Java Remote Debug: How do I ensure that the code I've got in my project is the same as the code running in the JVM? 如何在java中获取输出流的名称(即stderr或stdout)? - How to get name of output stream (i.e, stderr, or stdout) in java? 如何调试 ngrok 隧道暴露的远程 JVM - How to debug remote JVM exposed by ngrok tunnel 如何阻止Java / Eclipse一起使stdout和stderr崩溃? - How do I stop Java/Eclipse from bleeding stdout and stderr together? 如何在QtJambi中获取stdin,stdout,stderr文本流的QIODevice实例? - How to get QIODevice instance for stdin, stdout, stderr text streams in QtJambi? 如何在Cucumber JVM中捕获STDOUT,如Cucumber Ruby的看跌期权? - How do I capture STDOUT in Cucumber JVM like Cucumber Ruby's puts? 如何查看由-Dsun.security.krb5.debug JVM选项生成的调试信息? - How do I see the debug information generated by the -Dsun.security.krb5.debug JVM option? 如何将文本文件写入当前未在JVM中运行的Jar中 - How do I write a text file into a Jar that is not currently running in the JVM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM