简体   繁体   English

如何停止 Kafka 记录到 nohup.out 文件

[英]How to stop Kafka logging to nohup.out file

In the shell script runMyProgram.sh, the app is starting with this command:在 shell 脚本 runMyProgram.sh 中,应用程序使用以下命令启动:

nohup ${JAVA_HOME}/bin/java org.springframework.boot.loader.JarLauncher >> nohup.out 2>&1 & nohup ${JAVA_HOME}/bin/java org.springframework.boot.loader.JarLauncher >> nohup.out 2>&1 &

As soon as it starts, the nohup.out file is getting filled with Kafka certificate information, algorithm names, for example: org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1, WRITE: TLSv1.2 Handshake, length = 254, followed by encoded/decoded text.一旦启动,nohup.out 文件就会充满 Kafka 证书信息、算法名称,例如:org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1, WRITE: TLSv1.2 Handshake, length = 254,然后是编码/解码的文本。

I've tried changing the ">> nohup.out 2>&1" to other forms and combinations, didn't help.我尝试将“>> nohup.out 2>&1”更改为其他 forms 和组合,但没有帮助。

I've also tried setting all those package/classes level logging to OFF/FATAL/ERROR/in log4j2.xml file, that too didn't solve the problem.我还尝试在 log4j2.xml 文件中将所有这些包/类级别的日志记录设置为 OFF/FATAL/ERROR/,但这也没有解决问题。

Like so:像这样:

<logger name="org.springframework" additivity="false">
  <level value="OFF" />
  <appender-ref ref="ASYNC_ROOT"/></logger>

I've also excluded log4j from pom dependencies, didn't resolve either, like so:我还从 pom 依赖项中排除了 log4j ,也没有解决,如下所示:

<dependency>
   <groupId>org.springframework.kafka</groupId>
   <artifactId>spring-kafka</artifactId>
   <exclusions>
<exclusion>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
</exclusion></exclusions></dependency>

Try redirecting to dev/null尝试重定向到 dev/null

 nohup command_to_run  >/dev/null 2>&1

More info here: https://en.wikipedia.org/wiki/Null_device更多信息在这里: https://en.wikipedia.org/wiki/Null_device

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM