Version 2.3.3 of Scribe has been released:
Scribe is the fastest logging framework for the JVM, Scala.js, and Scala Native.
Most recent benchmark: https://jmh.morethan.io/?gist=https://gist.githubusercontent.com/darkfrog26/4d87d50ecc608801173bd259016bad2d/raw/070280e0b5bc9c251d640e5892a7ea64c549834a/gistfile1.txt
- 100% Programmatic configuration
- No required Java Logging libraries (though SLF4J is supported through a dependency)
- Clean DSL for configuration and logging
- Scala.js and Scala Native support
- Fastest logging library in the world
Does it support something like Log4J’s Mapped Diagnostic Context (MDC)?
We explored adding something similar to MDC (but with better asynchronous support), but saw very little practical use-cases for it. We do something, depending on your needs, that can be far more powerful. That is, the ability to log any object. Scribe isn’t limited to just logging
Throwable. You can supply any object that has a
Loggable (https://github.com/outr/scribe/blob/master/core/shared/src/main/scala/scribe/Loggable.scala) implicit available for it. This allows a lot of the same concepts of MDC, but without any of the unnecessary complexity. However, it comes with the requirement of having the object at the point in time that you want to log. This is a feature MDC supports and we don’t, but again, I have yet to see a practical scenario where this is necessary.
To sum up: No, we don’t have direct MDC support, but if any of our users can show a practical use-case where they need something like that we’ll add it.
I think the link I provided sums it up quite well; The use-case for it is when you log a sequence of events from different parts of your application, and want some thread-local stuff to be logged as well.
Think of a HTTP-request; at first you have a servlet-filter (or whatever) setting the key on MDC (and removing it again when request is finished). Then all logging done by services, views, whatever, logs the same key (and preferably also the username) making it possible to use those for connecting log-statements belonging to the same HTTP-request, and for what user. It’s insane to think that this info is available at every point of logging throughout the application. Log4J handles this just fine and I think this might prevent lots from switching to a framework which doesn’t support it.
In Java I completely agree, but I have yet to see this practically occur in Scala. Realize as well, that I maintain a web server, but my object structure allows for much better/cleaner access to things like this. I don’t have a problem adding this though.
Reopened the original ticket: https://github.com/outr/scribe/issues/11
In response here, MDC support has now been added to Scribe.