fzakaria / slf4j-timbre

SLF4J binding for Clojure's Timbre
Eclipse Public License 1.0
94 stars 23 forks source link

NoClassDefFoundError attempting to log using 0.3.18 #37

Closed coreagile closed 4 years ago

coreagile commented 4 years ago

When upgrading to 0.3.18 of slf4j-timbre, I'm getting the following stack trace:

java.lang.NoClassDefFoundError: taoensso/timbre$may_log_QMARK_
    at slf4j_timbre.adapter$_isDebugEnabled.invokeStatic(adapter.clj:159)
    at slf4j_timbre.adapter$_isDebugEnabled.invoke(adapter.clj:158)

These are my relevant dependencies:

[com.taoensso/timbre "4.10.0"]
[org.slf4j/log4j-over-slf4j "1.7.30"]
[org.slf4j/jul-to-slf4j "1.7.30"]
[org.slf4j/jcl-over-slf4j "1.7.30"]

Verified using lein deps :tree that [com.taoensso/timbre "4.10.0"] is indeed the version on the classpath.

rufoa commented 4 years ago

Sorry about that - will look into it ASAP

Did your code work correctly with 0.3.17?

On Sun, 26 Jan 2020, 14:32 Stephen Starkey, notifications@github.com wrote:

When upgrading to 0.3.18 of slf4j-timbre, I'm getting the following stack trace:

java.lang.NoClassDefFoundError: taoensso/timbre$may_logQMARK at slf4j_timbre.adapter$_isDebugEnabled.invokeStatic(adapter.clj:159) at slf4j_timbre.adapter$_isDebugEnabled.invoke(adapter.clj:158)

These are my relevant dependencies:

[com.taoensso/timbre "4.10.0"] [org.slf4j/log4j-over-slf4j "1.7.30"] [org.slf4j/jul-to-slf4j "1.7.30"] [org.slf4j/jcl-over-slf4j "1.7.30"]

Verified using lein deps :tree that [com.taoensso/timbre "4.10.0"] is indeed the version on the classpath.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fzakaria/slf4j-timbre/issues/37?email_source=notifications&email_token=AAOHHKDAUVBQZLAOHXZAO2TQ7WNJPA5CNFSM4KLXGXJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIYHV5Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOHHKBCWP7AZTYF5P42SO3Q7WNJPANCNFSM4KLXGXJA .

coreagile commented 4 years ago

It sure did! Thanks!

rufoa commented 4 years ago

Gotta be a problem with direct linking which the tests miss. Trying to reproduce

rufoa commented 4 years ago

The problem is that direct linking isn't playing nicely with the way we use AOT.

We need AOT for our own classes, but this causes our dependencies to undergo AOT as well, so we then strip those classes out of our jar as per CLJ-322 – and this includes Timbre.

If the project using slf4j-timbre (yours) doesn't happen to then AOT Timbre itself, then the invokestatic in our code fails in the way you saw.

I'll look into whether we could overcome this somehow using e.g. :redef true, but the immediate fix is to disable direct linking again.

rufoa commented 4 years ago

Should be fixed in 0.3.19, please lmk

coreagile commented 4 years ago

It works! Thanks!!