How to find out which backend is used to register slf4j in a third-party library?

I use the Scala library to create HTTP requests called Bee-Client. Bee-Client, for each individual action, prints a lot of debugging information to the console. The slf4j platform is used for this.

My problem is to disable this logging and redirect it to a file.

I tried different ways to disable java.util.logging, but they all have no meaning. Finally, I realized that slf4j can use other servers, but I have no idea how to recognize it.

Therefore, I can use both logs and Bee-Client source code. How to understand which logging protocol it uses?

+3
source share
2 answers

, , , . - API- java logging , . , maven : http://repo.bigbeeconsultants.co.uk/repo/uk/co/bigbeeconsultants/bee-client_2.10/latest/poms/bee-client_2.10.pom.

, Bee-Client . , SBT:

libraryDependencies ++= Seq(
    "uk.co.bigbeeconsultants" %% "bee-client" % "0.21.+",
    "org.slf4j" % "slf4j-api" % "1.7.+",
    "ch.qos.logback" % "logback-core"    % "1.0.+",
    "ch.qos.logback" % "logback-classic" % "1.0.+"
)

resolvers += "Big Bee Consultants" at "http://repo.bigbeeconsultants.co.uk/repo"

, slf4j api logback. , , logback , .

, - (, : src/main/resources/logback.xml). , :

<configuration>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>myApp.log</file>

    <encoder>
      <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
    </encoder>
  </appender>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%msg%n</pattern>
    </encoder>
  </appender>

  <root level="debug">
    <appender-ref ref="FILE" />
    <appender-ref ref="STDOUT" />
  </root>
</configuration>

. , logback.

+1

, , , .

+1

All Articles