adamwynne / twitter-api

Async io interface to all the twitter APIs
372 stars 64 forks source link

SLF4J dependency error #71

Open andreventer-ai opened 7 years ago

andreventer-ai commented 7 years ago

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.

chbrown commented 7 years ago

Hi @MaxBittker what do you mean by "get this running"? Those SLF4J lines are just warnings that the logging apparatus that http.async.client depends on isn't set up, so it's not going to log anything low-level about the underlying HTTP connection / requests / responses, but otherwise it runs just fine.

The documentation for clojure's tools.logging (and on GitHub) leaves a lot to be desired, but if you really want to dig in and get all the HTTP logs, I found Googling "project.clj logging clojure" a good place to start, particularly:

(P.S. This was in response to a subsequently-deleted comment: "Does anyone know how to get this running now? new to jvm ecosystem")

MaxBittker commented 7 years ago

hey chbrown, I actually was making a silly syntax mistake setting up hello world with this library and the warning just threw me off. thanks for your response!

alex314159 commented 6 years ago

Hello, thank you for the library. I have a similar issue - after I get these warnings, none of my existing clojure.tools.logging calls actually do anything - using the twitter-api works but seems to have broken my ability to log anything. Is this linked to SLF4J? thank you,

chbrown commented 6 years ago

Hi @alex314159, if you run lein deps :tree in this root of this repository, you'll see this output:

 [clj-oauth "1.5.5"]
   [clj-http "2.0.1"]
     [commons-io "2.4" :exclusions [[org.clojure/clojure]]]
     [org.apache.httpcomponents/httpclient "4.5" :exclusions [[org.clojure/clojure]]]
       [commons-logging "1.2"]
     [org.apache.httpcomponents/httpcore "4.4.1" :exclusions [[org.clojure/clojure]]]
     [org.apache.httpcomponents/httpmime "4.5" :exclusions [[org.clojure/clojure]]]
     [potemkin "0.4.1" :exclusions [[org.clojure/clojure]]]
       [clj-tuple "0.2.2"]
       [riddley "0.1.10"]
     [slingshot "0.12.2" :exclusions [[org.clojure/clojure]]]
   [commons-codec "1.8"]
   [org.bouncycastle/bcpkix-jdk15on "1.54"]
   [org.bouncycastle/bcprov-jdk15on "1.54"]
 [http.async.client "1.2.0"]
   [com.ning/async-http-client "1.9.39"]
     [io.netty/netty "3.10.5.Final"]
     [org.slf4j/slf4j-api "1.7.12"]
   [org.clojure/tools.logging "0.3.1"]
 [org.clojure/clojure "1.8.0"]
 [org.clojure/data.codec "0.1.0"]
 [org.clojure/data.json "0.2.6"]

twitter-api itself doesn't pull in any logging facilities, so if you're up against some sort of library conflict, it might be due to http.async.client's direct dependency on [org.clojure/tools.logging "0.3.1"] or its transitive dependency on org.slf4j/slf4j-api.

I can't replicate your precise issue without more details, but you might try adding a dependency on the latest http.async.client version and replacing your [twitter-api "1.8.0"] dependency with [twitter-api "1.8.0" :exclusions [http.async.client]].

LMK if that works and I'll see about updating the dependency in twitter-api.

alex314159 commented 6 years ago

thanks let me try. FWIW I tried your twttr repo too which doesn't use http.async.client - no SLF4J warning, and I get all my logs but in the repl instead of them being written to a log file - so maybe not just a http.async.client issue. I'll try and create a dummy app to isolate the problem.

chbrown commented 6 years ago

Yeah, I've been learning a lot about Java logging best practices lately, and your original comment reminded me to cut a new twttr release with my recent change that moved the logback-classic dependency into the :dev profile so that it doesn't constrain whatever logging backend the end-user (you) might happen to be using. So you might try the new [twttr "3.2.0"] — fresh off the press!

alex314159 commented 6 years ago

Chris, you're a star! The new twttr 3.2.0 is working fine with all my logs working as expected! A big thank you!!!