【发布时间】:2019-09-16 17:11:52
【问题描述】:
我在使用 Akka 进行日志记录时遇到问题。在我的 STDOUT 中,它并没有隐藏它们的 DEBUG 消息。在我的控制台中,我看到了这个:
12:45:27.790 [example-akka.kafka.default-dispatcher-18] DEBUG org.apache.kafka.clients.consumer.KafkaConsumer - [Consumer clientId=consumer-1, groupId=group1] Resuming partitions [test-topic-0]
12:45:27.823 [example-akka.kafka.default-dispatcher-18] DEBUG org.apache.kafka.clients.FetchSessionHandler - [Consumer clientId=consumer-1, groupId=group1] Node 1001 sent an incremental fetch response for session 1829476633 with 0 response partition(s), 1 implied partition(s)
所以我需要停止看到 DEBUG 消息。我的日志记录是这样的:
akka {
# Loggers to register at boot time (akka.event.Logging$DefaultLogger logs
# to STDOUT)
loggers = ["akka.event.slf4j.Slf4jLogger"]
# Log level used by the configured loggers (see "loggers") as soon
# as they have been started; before that, see "stdout-loglevel"
# Options: OFF, ERROR, WARNING, INFO, DEBUG
loglevel = "INFO"
# Log level for the very basic logger activated during ActorSystem startup.
# This logger prints the log messages to stdout (System.out).
# Options: OFF, ERROR, WARNING, INFO, DEBUG
stdout-loglevel = "INFO"
}
在我的 logback.xml 中,我正在写这个:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date{ISO8601} level=[%level] marker=[%marker] logger=[%logger] akkaSource=[%X{akkaSource}]
sourceActorSystem=[%X{sourceActorSystem}] sourceThread=[%X{sourceThread}] mdc=[ticket-#%X{ticketNumber}:
%X{ticketDesc}] - msg=[%msg]%n----%n
</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
为什么 DEBUG 消息没有停止?
我的项目结构
src -> main -> scala(这里是我在 Scala 中的源文件) src -> main -> scala -> 资源(这里是我的 lokback.xml 和 appliction.conf)
【问题讨论】:
-
你能发布你的 sbt 项目结构吗?
-
是的,我会发布这个
-
@M.K.我正在发布我的目录,但我无法发布它们的图片,所以我写了显示位置的箭头。
标签: scala logging apache-kafka akka slf4j