JDK Logging API

Why is the JDK Logging API considered so poor? What do we get with third-party APIs like Apache Log4j?

+4
source share
4 answers

In most cases, java.util.Logging is just fine. Most third-party registration protocols were developed before the Standard API completed registration.

+3
source

Log4j was created before the JDK Logging API. Currently, you prefer to use slf4j to work with the entire java logging world protocol.

+2
source

Im uses a (very very thin) self-laying layer on top of the JDK registry system because it is easy to use, easy to set up, and easy to expand. Even without this level, the JDK logging system is quite sufficient so that (in my opinion) there is no need for other logging APIs. Also, since it is included in the JDK, it should be considered a standard.

+1
source

This is because the Logger JDK class is not an interface. Therefore, you do not have (very little) control over how logging is performed.

With commons-logging, log4j, slf4j you can choose how and where it should log the message. Whether it is in a file, in a database, redirects it to register an application server, etc. With JDK registration you cannot. It is always a file. And if you want another level of journal, you cannot.

It uses varargs as slf4j, so you do not need to concatenate the String message in advance. But the other flaws are too great.

-2
source

Source: https://habr.com/ru/post/1343782/


All Articles