Apache Logging Services

Sunday July 17, 2016

Moving on to Log4j 2: Log4j 1.2 is broken on Java 9

Log4j 1 has had a good run. First released in 1999, it is still widely used in a variety of Java-based projects. With Java 9, that is likely to come to an end: Log4j 1.2 is broken on Java 9. Essentially the MDC depends on the Java version string, which does not play well with Java 9's new version-string format.

The Apache Logging PMC announced in August 2015 that Log4j 1 reached End Of Life and there would be no further releases. The announcement encouraged users to upgrade to its successor, Log4j 2.

What does this mean, concretely? Most of Log4j 1.2 will still work on Java 9. The issue described above is with the MDC (what is now called the ThreadContext map). If you don't use the MDC you may not be impacted, and even if you are impacted this workaround may help.

What has changed is that doing nothing is no longer the safest option. You could endeavor to continue using Log4j 1.2 even on Java 9, but why would you?

logo-2.6.2.png

If you're not using Log4j 2, this is what you're missing out on:

  • Improved reliability. Messages are not lost while reconfiguring the framework like in Log4j 1 or Logback
  • Extensibility: Log4j 2 supports a plugin system to let users define and configure custom components
  • Simplified configuration syntax, with support for xml, json, yaml and properties configurations
  • Improved Filters which can be defined globally or on any configuration element to give you fine-grained control over which log messages should be processed by which Loggers and Appenders.
  • Property lookup support for values defined in arbitrary places including, but not limited to, the configuration file, system properties, environment variables, the application container, the ThreadContext Map, and other attributes of the log event
  • Support for multiple APIs: Log4j 2 can be used with applications using the Log4j 2, Log4j 1.2, SLF4J, Commons Logging and java.util.logging (JUL) APIs
  • Custom Log Levels
  • Java 8-style lambda support for "lazy logging"
  • Markers
  • Support for user-defined Message objects
  • "Garbage-free or low garbage" in common configurations
  • Improved speed overall. Worth mentioning especially is the performance of the Asynchronous Loggers. Log4j 2 makes use of the LMAX Disruptor. The library reduces the need for kernel locking and increases the logging performance by a factor 12. For example, in the same environment Log4j 2 can write more than 18,000,000 messages per second, whereas other frameworks like Logback and Log4j 1 just write up to 2,000,000 messages per second.

Log4j 2 has an active and enthusiastic community who would be happy to help out with any migration issues that may come up.

To any project that is interested in running on Java 9, I'd strongly recommend migrating to Log4j 2 now.

Comments:

Are you interested in apache spark training? Join here gangboard. we are having the no.1 training institute. Our staffs having in depth knowledge about the technology. We are having the best trainers. They will satisfy your expectation. During the training period we are offering placement guidance to our students.so join here and get placed.

Posted by logavanig on July 18, 2016 at 09:09 AM UTC #

Indeed, we switched to log4j 2 two years back just because of Asynchronous logging it provides.

Posted by Javin on July 20, 2016 at 11:36 AM UTC #

staffs having in depth knowledge about the technology. We are having <a href="http://www.apache.org/">the</a> best trainers. They will satisfy your expectation.

Posted by ajaz on August 19, 2016 at 03:30 PM UTC #

get al the latest football schedule from our site

Posted by football schedule on February 05, 2019 at 07:57 AM UTC #

here i am sharing the latest collection of footbals

Posted by ohio state buckeyes on February 05, 2019 at 07:58 AM UTC #

Posted by ohio state buckeyes on February 05, 2019 at 07:58 AM UTC #

Posted by film izle on June 29, 2019 at 08:14 PM UTC #

Favorite Food Diet secret ingredient https://favoritefooddiet.net/

Posted by Chrissie Mitchell on July 18, 2019 at 07:01 AM UTC #

Cool Stuff! une animation du projet serait super

Posted by male on July 19, 2019 at 10:40 PM UTC #

I love how it makes me feel so curious! Very inspiring work !

Posted by clipincoka1978 on July 19, 2019 at 11:45 PM UTC #

perfect colours! Very cool, liking the colours!

Posted by trivunscalan1981 on July 20, 2019 at 03:47 PM UTC #

What can I say - simply amazing! Hey @Aevo Studio

Posted by workrimisfi1986 on July 20, 2019 at 04:08 PM UTC #

Your all work is very nice so I am waiting for your next project. Live interesting animation)

Posted by conzyrerent1979 on July 20, 2019 at 05:22 PM UTC #

-Manny Wow! This look is so unique! Reminds me of Picasso. ;-)

Posted by merlekingpidd1975 on July 20, 2019 at 05:43 PM UTC #

Tribute to the co(s)mic' stars. I'm fan(zine) ! So minimal and gorgeous.

Posted by forcecygos1973 on July 20, 2019 at 06:09 PM UTC #

These are so niiiiice! :) Those are EPIC!!! Awesome work!

Posted by inflavinal1975 on July 20, 2019 at 11:06 PM UTC #

GREATTTT Beautifully designed, great work!

Posted by cialosefelt1973 on July 21, 2019 at 12:02 AM UTC #

Poderosamente realista. Well done .

Posted by exenthalu1973 on July 21, 2019 at 02:22 AM UTC #

Fresh take on the almost-memphis style pattern! Lovely use of color too! Loved everything! Awesome work.

Posted by olydawpai1980 on July 21, 2019 at 04:01 AM UTC #

Increíbles ilustraciones!! :D Very nice work and presentation!

Posted by hardclifulal1989 on July 21, 2019 at 05:10 AM UTC #

So classy! Beautiful skin

Posted by chloronalsen1973 on July 21, 2019 at 05:48 AM UTC #

Super job! 带感

Posted by idicspensi1970 on July 21, 2019 at 06:23 AM UTC #

I never say no to a pint of Guinness in Ireland ... ; ) lovely work!

Posted by goatozukhu1989 on July 21, 2019 at 06:56 AM UTC #

You could be an example for others! Cool Absolutely gorgeous work as usual!

Posted by degmikeper1989 on July 21, 2019 at 07:29 AM UTC #

Looks like a potato Thankyou so much for all the kind words!

Posted by thernpassvorga1988 on July 21, 2019 at 08:00 AM UTC #

so cute!i love this project,amazing work! Great design! I really like your work and the way you combined the elements.

Posted by tolkabarra1978 on July 21, 2019 at 08:32 AM UTC #

thanks for sharing. Nicely done and presented!

Posted by abacacvas1978 on July 21, 2019 at 09:05 AM UTC #

woow I am amazed! Very stylish!

Posted by photuracta1978 on July 21, 2019 at 09:38 AM UTC #

Wow, beautiful work! Love the pigments and the dynamic of the liquid gold. Amazing work mate! I just love your style of illustrations!!

Posted by giosolgaipho1979 on July 21, 2019 at 10:11 AM UTC #

love theses warm desert colors Woooooww.... Great work you have here!

Posted by luedeezavan1984 on July 21, 2019 at 10:44 AM UTC #

Muchas gracias @David Sanden @Noem9 Studio @Andrés Gallardo Albajar !!! So fresh! Amazing job!

Posted by carmeibale1972 on July 21, 2019 at 11:17 AM UTC #

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Search

Hot Blogs (today's hits)

Tag Cloud

Categories

Feeds

Links

Navigation