Switch to Slf4j

Issue #18 resolved
Thomas Broyer created an issue

There are many (good) reasons to use Slf4j in place of Commons Logging:

For the time being, I can fortunately use jcl-over-slf4j and overcome those issues as a side-effect.

Comments (3)

  1. Brian Campbell repo owner

    Thanks for the suggestion @tbroyer. I'm vaguely aware of the opinions around SLF4J vs. Commons Logging. But having never really run into problems with Commons Logging (or slf4j) myself, I don't have strong feelings about it either way. I'll take a closer look though and consider a switch in future versions.

  2. Travis Spencer

    The reason I prefer SLF4J over Common logging is because the API of the former takes a format string whereas the latter takes the message as a String. So, with SLF4J, you have this nice code:

    _logger.debug("Foo = {}, bar = {}", foo, bar);
    

    In common logging, you have to have this:

    _logger.debug(String.format("Foo = %s, bar = %d", foo, bar);
    

    The common logging approach requires the call to String.format which also requires you to align the variable types and the markers in the format method.

  3. Log in to comment