gpt4 book ai didi

logging - 如何使用log4j在日志中打印spring kafka配置

转载 作者:行者123 更新时间:2023-12-03 09:04:38 24 4
gpt4 key购买 nike

有没有办法使用 log4j 在日志中记录所有 spring-kafka 配置?我尝试在应用程序 log4j2.yml 中使用以下记录器配置,我可以看到所有信息和调试日志,但看不到配置。 - 名称:org.springframework.kafka 可加性:假 级别:信息/调试 附加器引用: - 引用:SOME_APPENDER预先感谢您的帮助。

最佳答案

我认为您确实只需要担心应用于 Apache Kafka 客户端的属性。这也将涵盖 Spring Kafka 配置。为此,您只需为 org.apache.kafka.clients 类别配置 INFO

这是我的一项测试的日志:

16:55:20.616 INFO  [main][org.apache.kafka.clients.consumer.ConsumerConfig] ConsumerConfig values: 
auto.commit.interval.ms = 10
auto.offset.reset = earliest
bootstrap.servers = [127.0.0.1:56505]
check.crcs = true
client.id =
connections.max.idle.ms = 540000
enable.auto.commit = false
exclude.internal.topics = true
fetch.max.bytes = 52428800
fetch.max.wait.ms = 500
fetch.min.bytes = 1
group.id = blc
heartbeat.interval.ms = 3000
interceptor.classes = null
internal.leave.group.on.close = true
isolation.level = read_uncommitted
key.deserializer = class org.apache.kafka.common.serialization.IntegerDeserializer
max.partition.fetch.bytes = 1048576
max.poll.interval.ms = 300000
max.poll.records = 500
metadata.max.age.ms = 300000
metric.reporters = []
metrics.num.samples = 2
metrics.recording.level = INFO
metrics.sample.window.ms = 30000
partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor]
receive.buffer.bytes = 65536
reconnect.backoff.max.ms = 1000
reconnect.backoff.ms = 50
request.timeout.ms = 305000
retry.backoff.ms = 100
sasl.jaas.config = null
sasl.kerberos.kinit.cmd = /usr/bin/kinit
sasl.kerberos.min.time.before.relogin = 60000
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
sasl.kerberos.ticket.renew.window.factor = 0.8
sasl.mechanism = GSSAPI
security.protocol = PLAINTEXT
send.buffer.bytes = 131072
session.timeout.ms = 60000
ssl.cipher.suites = null
ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
ssl.endpoint.identification.algorithm = null
ssl.key.password = null
ssl.keymanager.algorithm = SunX509
ssl.keystore.location = null
ssl.keystore.password = null
ssl.keystore.type = JKS
ssl.protocol = TLS
ssl.provider = null
ssl.secure.random.implementation = null
ssl.trustmanager.algorithm = PKIX
ssl.truststore.location = null
ssl.truststore.password = null
ssl.truststore.type = JKS
value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer

关于logging - 如何使用log4j在日志中打印spring kafka配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47914528/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com