2014 Logging Frameworks You Would Like to Work With

In this post I want to recommend which libraries to use for your java project.

Main Logging Frameworks

Most notable frameworks in this section include: Java Util LoggingLog4jLogbackLog4j2

I will go over them one by one:
  • Java Util Logging - This is Java's official logging framework it has been there since 2002 and is mostly copied from log4j which have released their library two years before (2000). no significant updates have been released to the Java logging component and it is mostly abandoned (although it still resides in the rt.jar core java files), the brave developers who had tried using it report a complicated logging framework which needs a good overhaul and the general advice is to stay away from it!
  • Log4j - No need to introduce Log4j which is the most used logging framework, and is with us for over 14 years!, log4j is a very robust framework, and lots of documentation can be found about any question you might think to ask about it BUT log4j was created many years ago and it's code is reported to be old and unchanged for the last ... 8 years!, yes, the last significant release of log4j was at 2006 !? (And yes, it didn't adopt any changes introduced in java 1.5, 1.6, 1.7...). Log4j also lacks in performance and several advanced features can't be achieved using log4j (without extensive hacking). My advice is to stay away from this dead project.
  • Logback - One of the main creators of Log4j, created LogBack as its successor, recreating the logging library from scratch while fixing all which he thought needs fixing while adding new features on the go. Logback was started at 2006 as has regular updates, fixes all notable log4j bugs and succeeds in introducing several nice features. I fully recommend using Logback as your logging framework.
  • Log4j2 - Since July 2012, several guys which didn't like the idea of logback have decided to rebuild log4j from scratch - Please note that several of these guys are from the original group of log4j. Apache has recognized their effort as an official successor for log4j, thus named log4jv2.
    This project looks promising and I definitely recommend following after it as it fixes the big log4j bugs (performance issues and other bugs) while introducing some new features, but it is too early to adopt their library as it wasn't around enough time to be thoroughly used, so my recommendation will be to follow but not to adopt yet.

Logging APIs

The most notable java logging APIs are: Apache Commons LoggingSlf4j

I definitely suggest using a logging API, it just makes sense (from the reasons mentioned in my previous post), which one should you pick?

I will go over them one by one:
  • Apache Commons Logging - This was the first stab at having a unifying API for the logging frameworks, and while the idea was great, the implementation was poor, thus this project was abandoned at 2007, this project began at 2002, and almost no change had been done to the code since then. The main reason for this project's failure was that the library searched for a logging framework implementation at runtime which caused lots of bugs, till this project was declared unusable.
  • Slf4j - The same guy which created Logback (one of the main creators of the original log4j) has created this API, he has done great work and even has worked around some bugs found in logging implementation when using this API. This project is actively developed and the code was refactored several times since 2005. The logging implemetation library is determined at compile time thus preventing the main problems introduced in Apache commons logging. I definitely recommend using Slf4j.

Logging Parsers

I will give you only my bottom line on these components
I recommend using an IDE which has support for advanced parsing of log files.
In any other case where you need to parse log files I recommend using OtrosLogViewer


Popular posts from this blog

Start Working with AutoIT

How to read Android apk contents

SCummVM for Android