gpt4 book ai didi

scala - 记录到 Scala/akka 中的文件 : ClassNotFoundException: akka. event.slf4j.Slf4jLoggingFilter

转载 作者:行者123 更新时间:2023-12-04 11:22:03 33 4
gpt4 key购买 nike

我已经搜索了很多,但找不到可行的解决方案。有人可以帮我吗?

akka {
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "DEBUG"
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
stdout-loglevel = "WARNING"
actor {
debug {
receive = on
lifecycle = off
}
}
}

我已将以下内容添加到 build.sbt希望其中一个解决问题:
libraryDependencies ++= Seq (
"com.typesafe.akka" %% "akka-actor" % "2.4.1", // akka actors
"ch.qos.logback" % "logback-classic" % "1.1.3", //logback, in order to log to file
"com.typesafe.scala-logging" % "scala-logging-slf4j_2.11" % "2.1.2",
"com.typesafe.akka" % "akka-slf4j_2.11" % "2.4.1", // needed for logback to work
// and my other dependencies
)

我尝试了为 logback.xml 找到的不同建议,其中最后一个是:
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/filename.log</file>
<encoder>
<pattern>%date %level %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>10</maxIndex>
<FileNamePattern>logs/filename.log.%i.gz</FileNamePattern>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>20MB</maxFileSize>
</triggeringPolicy>
</appender>
<root level="info">
<appender-ref ref="FILE" />
</root>
</configuration>

编辑:我的完整依赖项如下(ps:我目前有 liftsalat 用于反/序列化,但这是另一回事):
libraryDependencies ++= Seq (
"org.scala-lang" % "scalap" % scalaVersion.value,
"com.typesafe.akka" %% "akka-actor" % "2.4.1",
"ch.qos.logback" % "logback-classic" % "1.1.3",
"com.typesafe.scala-logging" % "scala-logging-slf4j_2.11" % "2.1.2",
"com.typesafe.akka" %% "akka-slf4j" % "2.4.1",
"com.github.sstone" %% "amqp-client" % "1.5",
"net.liftweb" %% "lift-json" % "2.6.2",
"net.liftweb" %% "lift-json-ext" % "2.6.2",
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
"com.novus" %% "salat" % "1.9.9"
)

最佳答案

所以你用 "com.novus" %% "salat" % "1.9.9"这取决于 salat-util % 1.9.9 , 其中 dependsorg.slf4j % slf4j-api % 1.7.2 . Akka "com.typesafe.akka" %% "akka-slf4j" % "2.4.1" depends在 1.7.12。确保您需要整个 salat 包。也许您可以找到一种仅使用其中一部分的方法,或者以不同的方式配置日志记录,或者等待 Salat 开发人员的更新。

关于scala - 记录到 Scala/akka 中的文件 : ClassNotFoundException: akka. event.slf4j.Slf4jLoggingFilter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34133715/

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