2017-03-04 1 views
3

나는 Akka 및 Akka-http를 사용하여 간단한 서버를 개발 중입니다.SLF4J 클래스에서 "org.slf4j.impl.StaticLoggerBinder"메시지 오류를로드하지 못했습니다.

난 항상 인 IntelliJ에 응용 프로그램을 실행할 때 표준 출력에 다음과 같은 오류 메시지를 얻을 :

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
SLF4J: Defaulting to no-operation (NOP) logger implementation 
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 

나는 build.gradle에 다음과 같은 종속성이 있습니다

compile 'org.scala-lang:scala-library:2.12.1' 
compile 'com.typesafe.akka:akka-actor_2.12:2.4.17' 
compile 'com.typesafe.akka:akka-stream_2.12:2.4.17' 
compile 'com.typesafe.akka:akka-http_2.12:10.0.4' 
compile 'com.typesafe.akka:akka-http-spray-json_2.12:10.0.4' 
compile 'com.typesafe.akka:akka-slf4j_2.12:2.4.17' 

을 그리고 난으로 application.conf있다 아래에 주어진 :

마지막으로, 나는이 같은 로깅을 사용하고 있습니다 :

object HttpServer extends App with JsonSupport { 
    override def main(args: Array[String]): Unit = { 

    val config = ConfigFactory.load() 

    implicit val system = ActorSystem(config.getString("application.actor-system")) 
    implicit val materializer = ActorMaterializer() 

    // needed for the future flatMap/onComplete in the end 
    implicit val executionContext = system.dispatcher 

    val logger = Logging(system, getClass) 

왜 나는 항상 오류 진술을 알 수 있습니까?

답변

6

SLF4J 백엔드를 제공해야합니다. Akka docs Logback을 권장합니다. 이는 아래에 설명 된대로 종속성에 추가하여 얻을 수 있습니다. 종속성을 컴파일시 필요하지 않으므로 Runtime 플래그로 설정할 수도 있습니다.

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.3" % Runtime 

이 Akka의 특정 요구 사항은 아닙니다 참고 : SLF4J 단지 외관과 항상 로깅 백엔드를 필요로한다.

Logback을 선택하는 경우 로깅 설정에 logback.xml 파일을 제공하는 것이 좋습니다 (참조 용으로 this answer 참조).

Akka 내 로그인에 대해 알아야 할 것은 docs입니다.

+1

예, 작동합니다. 나는 내가 그것을 잊었다라고 생각할 수 없다! !!! 당신의 도움을 주셔서 감사합니다! –

+1

이것은 나를 위해 일한 - 경고를 없애 버렸지 만, 대신 여러 화면의 디버그 및 정보 로그가 있습니다. 위 응답의 문서 링크는 [이 답변] (https://stackoverflow.com/a/32003907) (기본적으로'logback.xml '을 추가하고 필요에 따라 구성)과 마찬가지로 도움이됩니다. – fazy

관련 문제