fzakaria / slf4j-timbre

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

Wrong number of args (3) passed to: adapter/-debug #2

Closed kenrestivo closed 8 years ago

kenrestivo commented 8 years ago

With

   [com.zaxxer/HikariCP "2.4.1"]
  [com.fzakaria/slf4j-timbre "0.2"]

Hikari throws this error:

                                  hikari-cp.core/make-datasource                          core.clj:  138
                       com.zaxxer.hikari.HikariDataSource.<init>             HikariDataSource.java:   69
                         com.zaxxer.hikari.HikariConfig.validate                 HikariConfig.java:  782
                 com.zaxxer.hikari.HikariConfig.logConfiguration                 HikariConfig.java:  826
      com.github.fzakaria.slf4j.timbre.TimbreLoggerAdapter.debug          TimbreLoggerAdapter.java:   63
com.github.fzakaria.slf4j.timbre.TimbreLoggerAdapterHelper.debug                                        
                                                             ...                                        
clojure.lang.ArityException: Wrong number of args (3) passed to: adapter/-debug

The relevant line in Hikari appears to be: https://github.com/brettwooldridge/HikariCP/blob/dev/src/main/java/com/zaxxer/hikari/HikariConfig.java#L839

Which is apparently not compatible with this: https://github.com/fzakaria/slf4j-timbre/blob/master/src/main/java/com/github/fzakaria/slf4j/timbre/TimbreLoggerAdapter.java#L63

Not sure who is in the right here (hikari or slf4j-timbre), but any help resolving this would be appreciated. Thanks!

fzakaria commented 8 years ago

Not sure. I can't seem to reproduce it. It looks to be like only a single string.

Here was my test:

@Test
public void HikarciCP() {
    Logger log = LoggerFactory.getLogger("basicLoggin");
    log.debug("{} - configuration:", "test");
    String prop = "blah blah password blah";
    String value = "test";
    value = (prop.contains("password") ? "<masked>" : value);
    log.debug((prop + "................................................").substring(0, 32) + (value != null ? value : ""));
}
rufoa commented 8 years ago

This is the issue my PR fixes

fzakaria commented 8 years ago

@rufo : Its a bit weird since the missing functionality was the throwable overloaded version. None of the code in HikariCP is using the throwable case that I could see.

In any case, sounds like it's resolved and the code is now live in clojars. Closing the issue

rufoa commented 8 years ago

I suspect the cause was actually line 828 which does use the throwable overload: https://github.com/brettwooldridge/HikariCP/blob/dev/src/main/java/com/zaxxer/hikari/HikariConfig.java#L828

fzakaria commented 8 years ago

riiiight. Well, solved. :)

kenrestivo commented 8 years ago

Thanks for the quick action on that!