A sneak peak into Log4j 2.7
Log4j 2.7 will be released in a few days. The community is now reviewing the release for any last minute showstopper. Meanwhile, you may be interested in a sneak peek into what is coming.
Log4j 2 is nominated for the JAX Innovation Awards! Do you like its performance, garbage-free logging, and easy and flexible configuration? Log4j 2 needs your love. Vote for Log4j 2! Voting closes September 29th, 2016. |
Scala API
Log4j 2.7 includes a Logging trait that removes some boilerplate code. Your Scala code can now look like this:
import org.apache.logging.log4j.scala.Logging class MyClass extends BaseClass with Logging { def doStuff(): Unit = { logger.info("Doing stuff") } }
This also enables a more compact form of parameterized logging. Instead of the common Java form:
logger.debug("Logging in user {} with birthday {}", user.getName(), user.calcBirthday());
In Scala, you can use
In addition to Log4j 2's Asynchronous Loggers, which are based on the LMAX Disruptor library, the 2.7 release allows you to configure the Async Appender to use a different queue implementation, including a few non-blocking ones: Context data is data that is set by the application to be included in all subsequent log events. The default source for context data is the ThreadContext.
From Log4j 2.7, users can configure a custom ContextDataInjector that can In addition, the ThreadContext map is now garbage-free. This is disabled by default, users need to enable this explicitly. RoutingAppender can now be configured with scripts, a new ScriptAppenderSelector was introduced that creates an Appender specified by a Script, FileAppender (and its Rolling equivalent) can now create files on-demand, and there are various other improvements.Non-Blocking Queues in Async Appender
Custom Context Data Injection
...and much more
Vote For Us!
Log4j 2 is nominated for the JAX Innovation Awards!
Do you like its performance, garbage-free logging, and easy and flexible configuration?
Log4j 2 needs your love.
Vote for Log4j 2!