简体   繁体   English

禁用 kafka 日志 clojure

[英]disable kafka logs clojure

I'm trying to disable Kafka logs in Clojure eg我正在尝试在 Clojure 中禁用 Kafka 日志,例如

[main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka version: 2.6.0

to at least ERROR level to no avail.至少到 ERROR 级别无济于事。 I'm using Logback and have set logback.xml under resources to:我正在使用 Logback 并将资源下的 logback.xml 设置为:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <logger name="org.apache" level="OFF"/>
    <logger name="kafka" level="OFF"/>
</configuration>

This is my project config btw:这是我的项目配置顺便说一句:

[[org.clojure/clojure "1.10.1"]
 [net.mikera/core.matrix "0.62.0"]
 [distributions "0.1.2"]
 [clj-time "0.15.2"]
 [incanter/incanter-charts "1.9.3"]
 [org.clojure/tools.logging "0.3.1"]
 [environ "1.1.0"]
 [ring/ring-core "1.5.0"]
 [ring/ring-jetty-adapter "1.5.0"]
 [ring/ring-json "0.4.0"]
 [metosin/compojure-api "1.1.9"]
 [clj-http "2.3.0"]
 [org.apache.kafka/kafka-streams "2.6.0"]
 [fundingcircle/jackdaw "0.7.2"]
 [com.fasterxml.jackson.core/jackson-databind "2.10.0"]
 [ring-cors "0.1.13"]
 [ch.qos.logback/logback-classic "1.2.3"]]

Any ideas what might be missing?任何想法可能会丢失什么?

I think it's either a dependencies problem or an issue with the configuration file not being packaged in the expected location.我认为这要么是依赖关系问题,要么是配置文件未打包在预期位置的问题。

  • In your project.clj I only see one dependency for logback.在您的project.clj我只看到一个 logback 依赖项。 Try adding the extra dependencies mentioned in this tutorial and see if makes any difference尝试添加本教程中提到的额外依赖项,看看是否有什么不同

  • I think it's most likely that the file is not being found at runtime, thus a default configuration is used instead (that's why you won't see the changes you expect).我认为很可能在运行时找不到该文件,因此使用默认配置(这就是为什么您不会看到您期望的更改)。 Check if the logback.xml file can be found along with the class files and not in a separate subfolder.检查logback.xml文件是否可以与类文件一起找到,而不是在单独的子文件夹中。

As it turns out the above configuration is just fine.事实证明,上面的配置很好。 After a new session it worked just great.在一个新的会话之后,它工作得很好。 No kafka messages.没有卡夫卡消息。 The previous configuration must have been cached somewhere.之前的配置一定已经缓存在某处。

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

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